Browse Source

bpo-46345: Add a test case for implicit `Optional` class attribute (GH-30535)

(cherry picked from commit 1de60155d5)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
pull/30573/head
Miss Islington (bot) 4 years ago
committed by GitHub
parent
commit
a468866a67
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      Lib/test/test_typing.py

6
Lib/test/test_typing.py

@ -3104,6 +3104,12 @@ class GetTypeHintTests(BaseTestCase):
'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:

Loading…
Cancel
Save