mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Issue #14386: Expose the dict_proxy internal type as types.MappingProxyType
This commit is contained in:
parent
8a1d04c643
commit
0db176f8f6
9 changed files with 369 additions and 75 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue