-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
GH-103699: Add __orig_bases__
to various typing classes
#103698
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
7a81c98
270cadf
29b643d
4037df1
19569f9
b777373
4c9ee8c
7224ddd
631d428
58701ac
3fe75eb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -7125,6 +7125,9 @@ class TD(TypedDict): | |||
a = A(a = 1) | ||||
self.assertIs(type(a), dict) | ||||
self.assertEqual(a, {'a': 1}) | ||||
|
||||
def test_orig_bases(self): | ||||
self.assertEqual(ChildTotalMovie.__orig_bases__, (ParentNontotalMovie,)) | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you add some more tests? Suggestions: a TypedDict with no bases, one with multiple bases, a generic TypedDict. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
cpython/Lib/test/test_typing.py Line 7017 in 4037df1
Tests for TypedDicts with no bases and multiple bases sound worth adding, though There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added quite a few :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should I remove the checks on generic TypedDicts then? Or move them all here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I think it's probably fine as is, actually. A little bit of duplication in tests isn't a massive issue, and it makes sense to both: 1). Test |
||||
|
||||
|
||||
class RequiredTests(BaseTestCase): | ||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Add ``__orig_bases__`` to non-generic TypedDicts | ||
adriangb marked this conversation as resolved.
Show resolved
Hide resolved
|
Uh oh!
There was an error while loading. Please reload this page.