diff --git a/Lib/test/test_pprint.py b/Lib/test/test_pprint.py index 95ffab77b56..d492d75b08d 100644 --- a/Lib/test/test_pprint.py +++ b/Lib/test/test_pprint.py @@ -471,8 +471,9 @@ def test_sort_unorderable_values(self): '{1: 0, ' + repr(Unorderable) +': 0}') # Issue 14998: TypeError on tuples with NoneTypes as dict keys. - self.assertEqual(pprint.pformat({(1,): 0, (None,): 0}), - '{(1,): 0, (None,): 0}') + keys = [(1,), (None,)] + self.assertEqual(pprint.pformat(dict.fromkeys(keys, 0)), + '{%r: 0, %r: 0}' % tuple(sorted(keys, key=id))) class DottedPrettyPrinter(pprint.PrettyPrinter):