Issue #14386: Expose the dict_proxy internal type as types.MappingProxyType

This commit is contained in:
Victor Stinner 2012-04-16 00:16:30 +02:00
parent 8a1d04c643
commit 0db176f8f6
9 changed files with 369 additions and 75 deletions

View file

@ -4574,11 +4574,11 @@ class DictProxyTests(unittest.TestCase):
self.assertEqual(type(C.__dict__), type(B.__dict__))
def test_repr(self):
# Testing dict_proxy.__repr__.
# Testing mappingproxy.__repr__.
# We can't blindly compare with the repr of another dict as ordering
# of keys and values is arbitrary and may differ.
r = repr(self.C.__dict__)
self.assertTrue(r.startswith('dict_proxy('), r)
self.assertTrue(r.startswith('mappingproxy('), r)
self.assertTrue(r.endswith(')'), r)
for k, v in self.C.__dict__.items():
self.assertIn('{!r}: {!r}'.format(k, v), r)