MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_integer

Method test_integer

Lib/test/test_pprint.py:374–384  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 3

TemperatureClass · 0.85
pformatMethod · 0.80
assertEqualMethod · 0.45

Tested by

no test coverage detected