diff --git a/Lib/test/test_typing.py b/Lib/test/test_typing.py index a94d77d4edf4be..9cb176eceacfab 100644 --- a/Lib/test/test_typing.py +++ b/Lib/test/test_typing.py @@ -3116,6 +3116,12 @@ def test_get_type_hints_classes(self): 'my_inner_a2': mod_generics_cache.B.A, 'my_outer_a': mod_generics_cache.A}) + def test_get_type_hints_classes_no_implicit_optional(self): + class WithNoneDefault: + field: int = None # most type-checkers won't be happy with it + + self.assertEqual(gth(WithNoneDefault), {'field': int}) + def test_respect_no_type_check(self): @no_type_check class NoTpCheck: