]> granicus.if.org Git - python/commitdiff
Trivial improvements to dataclasses tests. (GH-6234)
authorEric V. Smith <ericvsmith@users.noreply.github.com>
Sun, 25 Mar 2018 13:04:32 +0000 (09:04 -0400)
committerGitHub <noreply@github.com>
Sun, 25 Mar 2018 13:04:32 +0000 (09:04 -0400)
Lib/test/test_dataclasses.py

index 75e3cffc4a5e1822f06e478cbe63900b1182fd1d..df53b040c0e1ee6e3fbcdd7a47cbc9c137adc131 100755 (executable)
@@ -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),
                     }