You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: test-data/unit/check-errorcodes.test
+7-1Lines changed: 7 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -807,7 +807,7 @@ from typing_extensions import TypedDict
807
807
808
808
Foo = TypedDict("Bar", {}) # E: First argument "Bar" to TypedDict() does not match variable name "Foo" [name-match]
809
809
[builtins fixtures/dict.pyi]
810
-
[case testImplicitBool]
810
+
[case testTruthyBool]
811
811
# flags: --enable-error-code truthy-bool
812
812
from typing import List, Union
813
813
@@ -837,15 +837,21 @@ if s:
837
837
good_union: Union[str, int] = 5
838
838
if good_union:
839
839
pass
840
+
if not good_union:
841
+
pass
840
842
841
843
bad_union: Union[Foo, object] = Foo()
842
844
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]
843
845
pass
846
+
if not bad_union:
847
+
pass
844
848
845
849
def f():
846
850
pass
847
851
if f: # E: Function "def () -> Any" could always be true in boolean context [truthy-bool]
848
852
pass
853
+
if not f:
854
+
pass
849
855
conditional_result = 'foo' if f else 'bar' # E: Function "def () -> Any" could always be true in boolean context [truthy-bool]
0 commit comments