Skip to content

Commit 8ee1ec8

Browse files
committed
test: Add type assertion for NoneType() return value
1 parent f9330a7 commit 8ee1ec8

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

test-data/unit/check-classes.test

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3867,13 +3867,16 @@ def f(a: Type[Tuple[int, int]]):
38673867
[builtins fixtures/tuple.pyi]
38683868

38693869
[case testTypeUsingTypeCNoneType]
3870+
from typing_extensions import assert_type
38703871
NoneType = type(None)
3871-
type(None)()
3872-
NoneType()
3872+
assert_type(type(None)(), None)
3873+
assert_type(NoneType(), None)
3874+
38733875
def f(n: type[None]):
3874-
n()
3875-
def g(n: type[NoneType]):
3876-
n()
3876+
assert_type(n(), None)
3877+
def g(n: type[NoneType]): # type: ignore[valid-type]
3878+
assert_type(n(), None)
3879+
38773880
f(NoneType)
38783881
g(NoneType)
38793882
[out]

0 commit comments

Comments
 (0)