summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPierre Sassoulas <pierre.sassoulas@gmail.com>2023-04-26 13:16:21 +0200
committerPierre Sassoulas <pierre.sassoulas@gmail.com>2023-05-02 20:01:39 +0200
commit26686d544eab7236a92e56cc90c34b6e3a37f473 (patch)
treeca93e25911bdaa0608653d2a215d0b0fda5fbe1a /tests
parent87fe5e58c2013b4b1949836c142993464b153237 (diff)
downloadpylint-git-26686d544eab7236a92e56cc90c34b6e3a37f473.tar.gz
Merge the compare-to-zero extensions to 'implicit_booleaness_checker'
Diffstat (limited to 'tests')
-rw-r--r--tests/functional/ext/comparetozero/compare_to_zero.py46
-rw-r--r--tests/functional/ext/comparetozero/compare_to_zero.rc2
-rw-r--r--tests/functional/ext/comparetozero/compare_to_zero.txt6
-rw-r--r--tests/functional/u/use/use_implicit_booleaness_not_comparison_to_zero.py46
-rw-r--r--tests/functional/u/use/use_implicit_booleaness_not_comparison_to_zero.rc2
-rw-r--r--tests/functional/u/use/use_implicit_booleaness_not_comparison_to_zero.txt6
6 files changed, 54 insertions, 54 deletions
diff --git a/tests/functional/ext/comparetozero/compare_to_zero.py b/tests/functional/ext/comparetozero/compare_to_zero.py
deleted file mode 100644
index 6a14b8bc9..000000000
--- a/tests/functional/ext/comparetozero/compare_to_zero.py
+++ /dev/null
@@ -1,46 +0,0 @@
-# pylint: disable=literal-comparison,missing-docstring, singleton-comparison
-
-X = 123
-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
-
-if Y != 0: # [compare-to-zero]
- pass
-
-if 0 != X: # [compare-to-zero]
- pass
-
-if Y != False:
- pass
-
-if X > 0:
- pass
-
-if X < 0:
- pass
-
-if 0 < X:
- pass
-
-if 0 > X:
- pass
diff --git a/tests/functional/ext/comparetozero/compare_to_zero.rc b/tests/functional/ext/comparetozero/compare_to_zero.rc
deleted file mode 100644
index 70c6171b5..000000000
--- a/tests/functional/ext/comparetozero/compare_to_zero.rc
+++ /dev/null
@@ -1,2 +0,0 @@
-[MAIN]
-load-plugins=pylint.extensions.comparetozero,
diff --git a/tests/functional/ext/comparetozero/compare_to_zero.txt b/tests/functional/ext/comparetozero/compare_to_zero.txt
deleted file mode 100644
index a413a3268..000000000
--- a/tests/functional/ext/comparetozero/compare_to_zero.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-compare-to-zero:6:3:6:9::"""X is 0"" can be simplified to ""not 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
diff --git a/tests/functional/u/use/use_implicit_booleaness_not_comparison_to_zero.py b/tests/functional/u/use/use_implicit_booleaness_not_comparison_to_zero.py
new file mode 100644
index 000000000..766b1f547
--- /dev/null
+++ b/tests/functional/u/use/use_implicit_booleaness_not_comparison_to_zero.py
@@ -0,0 +1,46 @@
+# pylint: disable=literal-comparison,missing-docstring, singleton-comparison
+
+X = 123
+Y = len('test')
+
+if X is 0: # [use-implicit-booleaness-not-comparison-to-zero]
+ pass
+
+if X is False:
+ pass
+
+if Y is not 0: # [use-implicit-booleaness-not-comparison-to-zero]
+ pass
+
+if Y is not False:
+ pass
+
+if X == 0: # [use-implicit-booleaness-not-comparison-to-zero]
+ pass
+
+if X == False:
+ pass
+
+if 0 == Y: # [use-implicit-booleaness-not-comparison-to-zero]
+ pass
+
+if Y != 0: # [use-implicit-booleaness-not-comparison-to-zero]
+ pass
+
+if 0 != X: # [use-implicit-booleaness-not-comparison-to-zero]
+ pass
+
+if Y != False:
+ pass
+
+if X > 0:
+ pass
+
+if X < 0:
+ pass
+
+if 0 < X:
+ pass
+
+if 0 > X:
+ pass
diff --git a/tests/functional/u/use/use_implicit_booleaness_not_comparison_to_zero.rc b/tests/functional/u/use/use_implicit_booleaness_not_comparison_to_zero.rc
new file mode 100644
index 000000000..be01705b1
--- /dev/null
+++ b/tests/functional/u/use/use_implicit_booleaness_not_comparison_to_zero.rc
@@ -0,0 +1,2 @@
+[MAIN]
+enable=compare-to-zero,
diff --git a/tests/functional/u/use/use_implicit_booleaness_not_comparison_to_zero.txt b/tests/functional/u/use/use_implicit_booleaness_not_comparison_to_zero.txt
new file mode 100644
index 000000000..25702682a
--- /dev/null
+++ b/tests/functional/u/use/use_implicit_booleaness_not_comparison_to_zero.txt
@@ -0,0 +1,6 @@
+use-implicit-booleaness-not-comparison-to-zero:6:3:6:9::"""X is 0"" can be simplified to ""not X"" as 0 is falsey":HIGH
+use-implicit-booleaness-not-comparison-to-zero:12:3:12:13::"""Y is not 0"" can be simplified to ""Y"" as 0 is falsey":HIGH
+use-implicit-booleaness-not-comparison-to-zero:18:3:18:9::"""X == 0"" can be simplified to ""not X"" as 0 is falsey":HIGH
+use-implicit-booleaness-not-comparison-to-zero:24:3:24:9::"""0 == Y"" can be simplified to ""not Y"" as 0 is falsey":HIGH
+use-implicit-booleaness-not-comparison-to-zero:27:3:27:9::"""Y != 0"" can be simplified to ""Y"" as 0 is falsey":HIGH
+use-implicit-booleaness-not-comparison-to-zero:30:3:30:9::"""0 != X"" can be simplified to ""X"" as 0 is falsey":HIGH