-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
56e8a4f
commit db60551
Showing
4 changed files
with
108 additions
and
62 deletions.
There are no files selected for viewing
10 changes: 8 additions & 2 deletions
10
crates/ruff/resources/test/fixtures/pylint/compare_to_empty_string.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,19 @@ | ||
x = "a string" | ||
y = "another string" | ||
z = "" | ||
|
||
def should_raise_lint_warning(): | ||
|
||
def errors(): | ||
if x is "" or x == "": | ||
print("x is an empty string") | ||
|
||
if y is not "" or y != "": | ||
print("y is not an empty string") | ||
|
||
def should_not_raise_lint_warning(): | ||
if "" != z: | ||
print("z is an empty string") | ||
|
||
|
||
def ok(): | ||
if x and not y: | ||
print("x is not an empty string, but y is an empty string") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters