8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2a4c473 commit 3cca987Copy full SHA for 3cca987
test-data/unit/check-errorcodes.test
@@ -805,6 +805,22 @@ j = [x for x in lst if False] # E: If condition in comprehension is a
805
k = [x for x in lst if isinstance(x, int) or foo()] # E: If condition in comprehension is always true [redundant-expr]
806
[builtins fixtures/isinstancelist.pyi]
807
808
+[case testRedundantExprTruthiness]
809
+# flags: --enable-error-code redundant-expr
810
+from typing import List
811
+
812
+def maybe() -> bool: ...
813
814
+class Foo:
815
+ def __init__(self, x: List[int]) -> None:
816
+ self.x = x or []
817
818
+ def method(self) -> int:
819
+ if not self.x or maybe():
820
+ return 1
821
+ return 2
822
+[builtins fixtures/list.pyi]
823
824
[case testNamedTupleNameMismatch]
825
from typing import NamedTuple
826
0 commit comments