FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

bpo-46345: add a test case for implicit `Optional` class attribute by sobolevn · Pull Request #30535 · python/cpython · GitHub

/ cpython Public
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
6 changes: 6 additions & 0 deletions Lib/test/test_typing.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

Back | FazBrowse Home | New Git URL