Skip to content

Commit 51c9ab4

Browse files
authored
Trivial improvements to dataclasses tests. (GH-6234)
1 parent d5d9e02 commit 51c9ab4

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Lib/test/test_dataclasses.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -805,6 +805,7 @@ def bar(self) -> int:
805805
self.assertEqual(list(C.__annotations__), ['i'])
806806
self.assertEqual(C(10).foo(), 4)
807807
self.assertEqual(C(10).bar, 5)
808+
self.assertEqual(C(10).i, 10)
808809

809810
def test_post_init(self):
810811
# Just make sure it gets called
@@ -1488,7 +1489,7 @@ def nt(lst):
14881489
self.assertIs(type(t), NT)
14891490

14901491
def test_dynamic_class_creation(self):
1491-
cls_dict = {'__annotations__': OrderedDict(x=int, y=int),
1492+
cls_dict = {'__annotations__': {'x':int, 'y':int},
14921493
}
14931494

14941495
# Create the class.
@@ -1501,7 +1502,7 @@ def test_dynamic_class_creation(self):
15011502
self.assertEqual(asdict(cls(1, 2)), {'x': 1, 'y': 2})
15021503

15031504
def test_dynamic_class_creation_using_field(self):
1504-
cls_dict = {'__annotations__': OrderedDict(x=int, y=int),
1505+
cls_dict = {'__annotations__': {'x':int, 'y':int},
15051506
'y': field(default=5),
15061507
}
15071508

0 commit comments

Comments
 (0)