Skip to content

Commit e101c01

Browse files
author
hauntsaninja
committed
add a test
1 parent 5c6d763 commit e101c01

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

test-data/unit/check-errorcodes.test

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -807,7 +807,7 @@ from typing_extensions import TypedDict
807807

808808
Foo = TypedDict("Bar", {}) # E: First argument "Bar" to TypedDict() does not match variable name "Foo" [name-match]
809809
[builtins fixtures/dict.pyi]
810-
[case testImplicitBool]
810+
[case testTruthyBool]
811811
# flags: --enable-error-code truthy-bool
812812
from typing import List, Union
813813

@@ -837,15 +837,21 @@ if s:
837837
good_union: Union[str, int] = 5
838838
if good_union:
839839
pass
840+
if not good_union:
841+
pass
840842

841843
bad_union: Union[Foo, object] = Foo()
842844
if bad_union: # E: "__main__.bad_union" has type "Union[__main__.Foo, builtins.object]" of which no members implement __bool__ or __len__ so it could always be true in boolean context [truthy-bool]
843845
pass
846+
if not bad_union:
847+
pass
844848

845849
def f():
846850
pass
847851
if f: # E: Function "def () -> Any" could always be true in boolean context [truthy-bool]
848852
pass
853+
if not f:
854+
pass
849855
conditional_result = 'foo' if f else 'bar' # E: Function "def () -> Any" could always be true in boolean context [truthy-bool]
850856

851857
lst: List[int] = []

0 commit comments

Comments
 (0)