Skip to content

Commit a468866

Browse files
bpo-46345: Add a test case for implicit Optional class attribute (GH-30535)
(cherry picked from commit 1de6015) Co-authored-by: Nikita Sobolev <[email protected]>
1 parent 6f9ca53 commit a468866

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
@@ -3104,6 +3104,12 @@ def test_get_type_hints_classes(self):
31043104
'my_inner_a2': mod_generics_cache.B.A,
31053105
'my_outer_a': mod_generics_cache.A})
31063106

3107+
def test_get_type_hints_classes_no_implicit_optional(self):
3108+
class WithNoneDefault:
3109+
field: int = None # most type-checkers won't be happy with it
3110+
3111+
self.assertEqual(gth(WithNoneDefault), {'field': int})
3112+
31073113
def test_respect_no_type_check(self):
31083114
@no_type_check
31093115
class NoTpCheck:

0 commit comments

Comments
 (0)