diff options
author | Eric V. Smith <ericvsmith@users.noreply.github.com> | 2018-03-25 13:04:32 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-25 13:04:32 (GMT) |
commit | 51c9ab42ab84643081d75c83a586afa45d910383 (patch) | |
tree | d1db62a05b580f1cdbd64512c7559d8d76422252 /Lib/test | |
parent | d5d9e02dd3c6df06a8dd9ce75ee9b52976420a8b (diff) | |
download | cpython-51c9ab42ab84643081d75c83a586afa45d910383.zip cpython-51c9ab42ab84643081d75c83a586afa45d910383.tar.gz cpython-51c9ab42ab84643081d75c83a586afa45d910383.tar.bz2 |
Trivial improvements to dataclasses tests. (GH-6234)
Diffstat (limited to 'Lib/test')
-rwxr-xr-x | Lib/test/test_dataclasses.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Lib/test/test_dataclasses.py b/Lib/test/test_dataclasses.py index 75e3cff..df53b04 100755 --- a/Lib/test/test_dataclasses.py +++ b/Lib/test/test_dataclasses.py @@ -805,6 +805,7 @@ class TestCase(unittest.TestCase): self.assertEqual(list(C.__annotations__), ['i']) self.assertEqual(C(10).foo(), 4) self.assertEqual(C(10).bar, 5) + self.assertEqual(C(10).i, 10) def test_post_init(self): # Just make sure it gets called @@ -1488,7 +1489,7 @@ class TestCase(unittest.TestCase): self.assertIs(type(t), NT) def test_dynamic_class_creation(self): - cls_dict = {'__annotations__': OrderedDict(x=int, y=int), + cls_dict = {'__annotations__': {'x':int, 'y':int}, } # Create the class. @@ -1501,7 +1502,7 @@ class TestCase(unittest.TestCase): self.assertEqual(asdict(cls(1, 2)), {'x': 1, 'y': 2}) def test_dynamic_class_creation_using_field(self): - cls_dict = {'__annotations__': OrderedDict(x=int, y=int), + cls_dict = {'__annotations__': {'x':int, 'y':int}, 'y': field(default=5), } |