Skip to content

Commit a500826

Browse files
committed
Test that we do not try to handle other operators
1 parent cae4615 commit a500826

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

test-data/unit/check-unreachable-code.test

+10
Original file line numberDiff line numberDiff line change
@@ -540,6 +540,16 @@ reveal_type(not_or_t) # N: Revealed type is "builtins.bool"
540540
reveal_type(not_or_f) # N: Revealed type is "Literal['s']"
541541
[builtins fixtures/ops.pyi]
542542

543+
[case testConditionalValuesUnsupportedOps]
544+
# flags: --platform linux
545+
import sys
546+
547+
unary_minus = -(sys.platform == 'linux') and 's'
548+
binary_minus = ((sys.platform == 'linux') - (sys.platform == 'linux')) and 's'
549+
reveal_type(unary_minus) # N: Revealed type is "Union[Literal[0], builtins.str]"
550+
reveal_type(binary_minus) # N: Revealed type is "Union[Literal[0], builtins.str]"
551+
[builtins fixtures/ops.pyi]
552+
543553
[case testShortCircuitAndWithConditionalAssignment]
544554
# flags: --platform linux
545555
import sys

0 commit comments

Comments
 (0)