mirror of https://github.com/astral-sh/ruff
update test for plc1901
This commit is contained in:
parent
fc50d28fcf
commit
2f3734dd22
|
|
@ -1,8 +1,11 @@
|
|||
x = ""
|
||||
y = "hello"
|
||||
x = "a string"
|
||||
y = "another string"
|
||||
|
||||
if x == "": # [compare-to-empty-string]
|
||||
if x is "" or x == "":
|
||||
print("x is an empty string")
|
||||
|
||||
if y != "": # [compare-to-empty-string]
|
||||
if y is not "" or y != "":
|
||||
print("y is not an empty string")
|
||||
|
||||
if x and not y:
|
||||
print("x is not an empty string, but y is an empty string")
|
||||
|
|
|
|||
|
|
@ -3,7 +3,10 @@ source: crates/ruff/src/rules/pylint/mod.rs
|
|||
expression: diagnostics
|
||||
---
|
||||
- kind:
|
||||
CompareToEmptyString: ~
|
||||
CompareToEmptyString:
|
||||
lhs: x
|
||||
op: Is
|
||||
rhs: "\"\""
|
||||
location:
|
||||
row: 4
|
||||
column: 3
|
||||
|
|
@ -13,7 +16,23 @@ expression: diagnostics
|
|||
fix: ~
|
||||
parent: ~
|
||||
- kind:
|
||||
CompareToEmptyString: ~
|
||||
CompareToEmptyString:
|
||||
lhs: x
|
||||
op: Eq
|
||||
rhs: "\"\""
|
||||
location:
|
||||
row: 4
|
||||
column: 14
|
||||
end_location:
|
||||
row: 4
|
||||
column: 15
|
||||
fix: ~
|
||||
parent: ~
|
||||
- kind:
|
||||
CompareToEmptyString:
|
||||
lhs: y
|
||||
op: IsNot
|
||||
rhs: "\"\""
|
||||
location:
|
||||
row: 7
|
||||
column: 3
|
||||
|
|
@ -22,4 +41,17 @@ expression: diagnostics
|
|||
column: 4
|
||||
fix: ~
|
||||
parent: ~
|
||||
- kind:
|
||||
CompareToEmptyString:
|
||||
lhs: y
|
||||
op: NotEq
|
||||
rhs: "\"\""
|
||||
location:
|
||||
row: 7
|
||||
column: 18
|
||||
end_location:
|
||||
row: 7
|
||||
column: 19
|
||||
fix: ~
|
||||
parent: ~
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue