(self)
| 499 | self.assertEqual(pprint.pformat(Temperature(1000)), '1273.15°K') |
| 500 | |
| 501 | def test_sorted_dict(self): |
| 502 | # Starting in Python 2.5, pprint sorts dict displays by key regardless |
| 503 | # of how small the dictionary may be. |
| 504 | # Before the change, on 32-bit Windows pformat() gave order |
| 505 | # 'a', 'c', 'b' here, so this test failed. |
| 506 | d = {'a': 1, 'b': 1, 'c': 1} |
| 507 | self.assertEqual(pprint.pformat(d), "{'a': 1, 'b': 1, 'c': 1}") |
| 508 | self.assertEqual(pprint.pformat([d, d]), |
| 509 | "[{'a': 1, 'b': 1, 'c': 1}, {'a': 1, 'b': 1, 'c': 1}]") |
| 510 | |
| 511 | # The next one is kind of goofy. The sorted order depends on the |
| 512 | # alphabetic order of type names: "int" < "str" < "tuple". Before |
| 513 | # Python 2.5, this was in the test_same_as_repr() test. It's worth |
| 514 | # keeping around for now because it's one of few tests of pprint |
| 515 | # against a crazy mix of types. |
| 516 | self.assertEqual(pprint.pformat({"xy\tab\n": (3,), 5: [[]], (): {}}), |
| 517 | r"{5: [[]], 'xy\tab\n': (3,), (): {}}") |
| 518 | |
| 519 | def test_sort_dict(self): |
| 520 | d = dict.fromkeys('cba') |
nothing calls this directly
no test coverage detected