MCPcopy Index your code
hub / github.com/python/cpython / Temperature

Class Temperature

Lib/test/test_pprint.py:493–498  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

491 self.assertEqual(pprint.pformat(1234567, underscore_numbers=True), '1_234_567')
492
493 class Temperature(int):
494 def __new__(cls, celsius_degrees):
495 return super().__new__(Temperature, celsius_degrees)
496 def __repr__(self):
497 kelvin_degrees = self + 273.15
498 return f"{kelvin_degrees:.2f}°K"
499 self.assertEqual(pprint.pformat(Temperature(1000)), '1273.15°K')
500
501 def test_sorted_dict(self):

Callers 1

test_integerMethod · 0.85

Calls

no outgoing calls

Tested by 1

test_integerMethod · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…