Skip to content

Commit

Permalink
Regression test for make_simplified_union truthiness (#15098)
Browse files Browse the repository at this point in the history
Add a test for the code path exercised in #15094
  • Loading branch information
hauntsaninja authored Apr 21, 2023
1 parent 2a4c473 commit 3cca987
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test-data/unit/check-errorcodes.test
Original file line number Diff line number Diff line change
Expand Up @@ -805,6 +805,22 @@ j = [x for x in lst if False] # E: If condition in comprehension is a
k = [x for x in lst if isinstance(x, int) or foo()] # E: If condition in comprehension is always true [redundant-expr]
[builtins fixtures/isinstancelist.pyi]

[case testRedundantExprTruthiness]
# flags: --enable-error-code redundant-expr
from typing import List

def maybe() -> bool: ...

class Foo:
def __init__(self, x: List[int]) -> None:
self.x = x or []

def method(self) -> int:
if not self.x or maybe():
return 1
return 2
[builtins fixtures/list.pyi]

[case testNamedTupleNameMismatch]
from typing import NamedTuple

Expand Down

0 comments on commit 3cca987

Please sign in to comment.