(self)
| 372 | '2']]]]]""") |
| 373 | |
| 374 | def test_integer(self): |
| 375 | self.assertEqual(pprint.pformat(1234567), '1234567') |
| 376 | self.assertEqual(pprint.pformat(1234567, underscore_numbers=True), '1_234_567') |
| 377 | |
| 378 | class Temperature(int): |
| 379 | def __new__(cls, celsius_degrees): |
| 380 | return super().__new__(Temperature, celsius_degrees) |
| 381 | def __repr__(self): |
| 382 | kelvin_degrees = self + 273.15 |
| 383 | return f"{kelvin_degrees:.2f}°K" |
| 384 | self.assertEqual(pprint.pformat(Temperature(1000)), '1273.15°K') |
| 385 | |
| 386 | def test_sorted_dict(self): |
| 387 | # Starting in Python 2.5, pprint sorts dict displays by key regardless |
nothing calls this directly
no test coverage detected