Skip to content

Commit 1de6015

Browse files
authored
bpo-46345: Add a test case for implicit Optional class attribute (GH-30535)
1 parent ed57b36 commit 1de6015

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Lib/test/test_typing.py

+6
Original file line numberDiff line numberDiff line change
@@ -3177,6 +3177,12 @@ def test_get_type_hints_classes(self):
31773177
'my_inner_a2': mod_generics_cache.B.A,
31783178
'my_outer_a': mod_generics_cache.A})
31793179

3180+
def test_get_type_hints_classes_no_implicit_optional(self):
3181+
class WithNoneDefault:
3182+
field: int = None # most type-checkers won't be happy with it
3183+
3184+
self.assertEqual(gth(WithNoneDefault), {'field': int})
3185+
31803186
def test_respect_no_type_check(self):
31813187
@no_type_check
31823188
class NoTpCheck:

0 commit comments

Comments
 (0)