mirror of
https://github.com/python/cpython.git
synced 2025-10-26 08:19:20 +00:00
Fix test_pprint random dict ordering.
This commit is contained in:
commit
0fd1062a76
1 changed files with 3 additions and 2 deletions
|
|
@ -471,8 +471,9 @@ class QueryTestCase(unittest.TestCase):
|
||||||
'{1: 0, ' + repr(Unorderable) +': 0}')
|
'{1: 0, ' + repr(Unorderable) +': 0}')
|
||||||
|
|
||||||
# Issue 14998: TypeError on tuples with NoneTypes as dict keys.
|
# Issue 14998: TypeError on tuples with NoneTypes as dict keys.
|
||||||
self.assertEqual(pprint.pformat({(1,): 0, (None,): 0}),
|
keys = [(1,), (None,)]
|
||||||
'{(1,): 0, (None,): 0}')
|
self.assertEqual(pprint.pformat(dict.fromkeys(keys, 0)),
|
||||||
|
'{%r: 0, %r: 0}' % tuple(sorted(keys, key=id)))
|
||||||
|
|
||||||
|
|
||||||
class DottedPrettyPrinter(pprint.PrettyPrinter):
|
class DottedPrettyPrinter(pprint.PrettyPrinter):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue