Skip to content

Commit 78b0da8

Browse 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

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

Lib/test/test_typing.py

Lines 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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy