Trivial improvements to dataclasses tests. (GH-6234)

(cherry picked from commit 51c9ab42ab)

Co-authored-by: Eric V. Smith <ericvsmith@users.noreply.github.com>
This commit is contained in:
Miss Islington (bot) 2018-03-25 06:27:50 -07:00 committed by GitHub
parent 2dd885eaa0
commit 5666a55da8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -805,6 +805,7 @@ class TestCase(unittest.TestCase):
self.assertEqual(list(C.__annotations__), ['i']) self.assertEqual(list(C.__annotations__), ['i'])
self.assertEqual(C(10).foo(), 4) self.assertEqual(C(10).foo(), 4)
self.assertEqual(C(10).bar, 5) self.assertEqual(C(10).bar, 5)
self.assertEqual(C(10).i, 10)
def test_post_init(self): def test_post_init(self):
# Just make sure it gets called # Just make sure it gets called
@ -1488,7 +1489,7 @@ class TestCase(unittest.TestCase):
self.assertIs(type(t), NT) self.assertIs(type(t), NT)
def test_dynamic_class_creation(self): def test_dynamic_class_creation(self):
cls_dict = {'__annotations__': OrderedDict(x=int, y=int), cls_dict = {'__annotations__': {'x':int, 'y':int},
} }
# Create the class. # Create the class.
@ -1501,7 +1502,7 @@ class TestCase(unittest.TestCase):
self.assertEqual(asdict(cls(1, 2)), {'x': 1, 'y': 2}) self.assertEqual(asdict(cls(1, 2)), {'x': 1, 'y': 2})
def test_dynamic_class_creation_using_field(self): 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), 'y': field(default=5),
} }