mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-02 06:42:02 +00:00
[semantic-syntax-tests] for for InvalidStarExpression
, DuplicateMatchKey
, and DuplicateMatchClassAttribute
(#17754)
Re: #17526 ## Summary Add integration tests for Python Semantic Syntax for `InvalidStarExpression`, `DuplicateMatchKey`, and `DuplicateMatchClassAttribute`. ## Note - Red knot integration tests for `DuplicateMatchKey` exist already in line 89-101. <!-- What's the purpose of the change? What does it do, and why? --> ## Test Plan This is a test. <!-- How was it tested? -->
This commit is contained in:
parent
965a4dd731
commit
101e1a5ddd
7 changed files with 136 additions and 0 deletions
|
@ -1063,6 +1063,53 @@ mod tests {
|
|||
PythonVersion::PY310,
|
||||
"MultipleCaseAssignment"
|
||||
)]
|
||||
#[test_case(
|
||||
"duplicate_match_key",
|
||||
"
|
||||
match x:
|
||||
case {'key': 1, 'key': 2}:
|
||||
pass
|
||||
",
|
||||
PythonVersion::PY310,
|
||||
"DuplicateMatchKey"
|
||||
)]
|
||||
#[test_case(
|
||||
"duplicate_match_class_attribute",
|
||||
"
|
||||
match x:
|
||||
case Point(x=1, x=2):
|
||||
pass
|
||||
",
|
||||
PythonVersion::PY310,
|
||||
"DuplicateMatchClassAttribute"
|
||||
)]
|
||||
#[test_case(
|
||||
"invalid_star_expression",
|
||||
"
|
||||
def func():
|
||||
return *x
|
||||
",
|
||||
PythonVersion::PY310,
|
||||
"InvalidStarExpression"
|
||||
)]
|
||||
#[test_case(
|
||||
"invalid_star_expression_for",
|
||||
"
|
||||
for *x in range(10):
|
||||
pass
|
||||
",
|
||||
PythonVersion::PY310,
|
||||
"InvalidStarExpression"
|
||||
)]
|
||||
#[test_case(
|
||||
"invalid_star_expression_yield",
|
||||
"
|
||||
def func():
|
||||
yield *x
|
||||
",
|
||||
PythonVersion::PY310,
|
||||
"InvalidStarExpression"
|
||||
)]
|
||||
fn test_semantic_errors(
|
||||
name: &str,
|
||||
contents: &str,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue