Skip to content

Commit

Permalink
bpo-46345: Add a test case for implicit Optional class attribute (G…
Browse files Browse the repository at this point in the history
…H-30535)

(cherry picked from commit 1de6015)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
  • Loading branch information
miss-islington and sobolevn committed Jan 13, 2022
1 parent 6f9ca53 commit a468866
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Lib/test/test_typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -3104,6 +3104,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:
Expand Down

0 comments on commit a468866

Please sign in to comment.