summaryrefslogtreecommitdiff
path: root/tests/functional/ext
diff options
context:
space:
mode:
authorPierre Sassoulas <pierre.sassoulas@gmail.com>2022-11-06 19:16:49 +0100
committerPierre Sassoulas <pierre.sassoulas@gmail.com>2022-11-07 21:30:49 +0100
commita1b7020d72d9f8f683dc0460cbb2eaf1edbefd25 (patch)
tree26abb17fa3d0f2ff23a73f42d5dcbbb5be9270f4 /tests/functional/ext
parent472064a9ee85973f0f1d7b87c720199e1c147599 (diff)
downloadpylint-git-a1b7020d72d9f8f683dc0460cbb2eaf1edbefd25.tar.gz
[compare to zero] Fix false positive with 'x is False'
Diffstat (limited to 'tests/functional/ext')
-rw-r--r--tests/functional/ext/comparetozero/compare_to_zero.py14
-rw-r--r--tests/functional/ext/comparetozero/compare_to_zero.txt10
2 files changed, 18 insertions, 6 deletions
diff --git a/tests/functional/ext/comparetozero/compare_to_zero.py b/tests/functional/ext/comparetozero/compare_to_zero.py
index 137fef8b2..6a14b8bc9 100644
--- a/tests/functional/ext/comparetozero/compare_to_zero.py
+++ b/tests/functional/ext/comparetozero/compare_to_zero.py
@@ -1,4 +1,4 @@
-# pylint: disable=literal-comparison,missing-docstring
+# pylint: disable=literal-comparison,missing-docstring, singleton-comparison
X = 123
Y = len('test')
@@ -6,12 +6,21 @@ Y = len('test')
if X is 0: # [compare-to-zero]
pass
+if X is False:
+ pass
+
if Y is not 0: # [compare-to-zero]
pass
+if Y is not False:
+ pass
+
if X == 0: # [compare-to-zero]
pass
+if X == False:
+ pass
+
if 0 == Y: # [compare-to-zero]
pass
@@ -21,6 +30,9 @@ if Y != 0: # [compare-to-zero]
if 0 != X: # [compare-to-zero]
pass
+if Y != False:
+ pass
+
if X > 0:
pass
diff --git a/tests/functional/ext/comparetozero/compare_to_zero.txt b/tests/functional/ext/comparetozero/compare_to_zero.txt
index 9d80d8161..a413a3268 100644
--- a/tests/functional/ext/comparetozero/compare_to_zero.txt
+++ b/tests/functional/ext/comparetozero/compare_to_zero.txt
@@ -1,6 +1,6 @@
compare-to-zero:6:3:6:9::"""X is 0"" can be simplified to ""not X"" as 0 is falsey":HIGH
-compare-to-zero:9:3:9:13::"""Y is not 0"" can be simplified to ""Y"" as 0 is falsey":HIGH
-compare-to-zero:12:3:12:9::"""X == 0"" can be simplified to ""not X"" as 0 is falsey":HIGH
-compare-to-zero:15:3:15:9::"""0 == Y"" can be simplified to ""not Y"" as 0 is falsey":HIGH
-compare-to-zero:18:3:18:9::"""Y != 0"" can be simplified to ""Y"" as 0 is falsey":HIGH
-compare-to-zero:21:3:21:9::"""0 != X"" can be simplified to ""X"" as 0 is falsey":HIGH
+compare-to-zero:12:3:12:13::"""Y is not 0"" can be simplified to ""Y"" as 0 is falsey":HIGH
+compare-to-zero:18:3:18:9::"""X == 0"" can be simplified to ""not X"" as 0 is falsey":HIGH
+compare-to-zero:24:3:24:9::"""0 == Y"" can be simplified to ""not Y"" as 0 is falsey":HIGH
+compare-to-zero:27:3:27:9::"""Y != 0"" can be simplified to ""Y"" as 0 is falsey":HIGH
+compare-to-zero:30:3:30:9::"""0 != X"" can be simplified to ""X"" as 0 is falsey":HIGH