update test for plc1901

This commit is contained in:
AreamanM 2023-03-08 22:47:04 +00:00 committed by Charlie Marsh
parent fc50d28fcf
commit 2f3734dd22
2 changed files with 41 additions and 6 deletions

View File

@ -1,8 +1,11 @@
x = "" x = "a string"
y = "hello" y = "another string"
if x == "": # [compare-to-empty-string] if x is "" or x == "":
print("x is an empty string") 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") 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")

View File

@ -3,7 +3,10 @@ source: crates/ruff/src/rules/pylint/mod.rs
expression: diagnostics expression: diagnostics
--- ---
- kind: - kind:
CompareToEmptyString: ~ CompareToEmptyString:
lhs: x
op: Is
rhs: "\"\""
location: location:
row: 4 row: 4
column: 3 column: 3
@ -13,7 +16,23 @@ expression: diagnostics
fix: ~ fix: ~
parent: ~ parent: ~
- kind: - 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: location:
row: 7 row: 7
column: 3 column: 3
@ -22,4 +41,17 @@ expression: diagnostics
column: 4 column: 4
fix: ~ fix: ~
parent: ~ parent: ~
- kind:
CompareToEmptyString:
lhs: y
op: NotEq
rhs: "\"\""
location:
row: 7
column: 18
end_location:
row: 7
column: 19
fix: ~
parent: ~