Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 78b0da8

Browse filesBrowse files
Daraanmiss-islington
authored andcommitted
Add test checking value of a TypedDict's __total__ attribute when there is an assignment in the class body. (pythonGH-130460)
In relation to pythonGH-109544 which changed this behavior. (cherry picked from commit d8ce092) Co-authored-by: Daraan <github.blurry@9ox.net> Signed-off-by: Daniel Sperber <github.blurry@9ox.net>
1 parent 27a28ee commit 78b0da8
Copy full SHA for 78b0da8

File tree

Expand file treeCollapse file tree

1 file changed

+16
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+16
-0
lines changed

‎Lib/test/test_typing.py

Copy file name to clipboardExpand all lines: Lib/test/test_typing.py
+16Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8356,6 +8356,22 @@ class TD2(TD1):
83568356

83578357
self.assertIs(TD2.__total__, True)
83588358

8359+
def test_total_with_assigned_value(self):
8360+
class TD(TypedDict):
8361+
__total__ = "some_value"
8362+
8363+
self.assertIs(TD.__total__, True)
8364+
8365+
class TD2(TypedDict, total=True):
8366+
__total__ = "some_value"
8367+
8368+
self.assertIs(TD2.__total__, True)
8369+
8370+
class TD3(TypedDict, total=False):
8371+
__total__ = "some value"
8372+
8373+
self.assertIs(TD3.__total__, False)
8374+
83598375
def test_optional_keys(self):
83608376
class Point2Dor3D(Point2D, total=False):
83618377
z: int

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.