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

Class DummyIntegral

Lib/test/test_numeric_tower.py:18–35  ·  view source on GitHub ↗

Dummy Integral class to test conversion of the Rational to float.

Source from the content-addressed store, hash-verified

16
17
18class DummyIntegral(int):
19 """Dummy Integral class to test conversion of the Rational to float."""
20
21 def __mul__(self, other):
22 return DummyIntegral(super().__mul__(other))
23 __rmul__ = __mul__
24
25 def __truediv__(self, other):
26 return NotImplemented
27 __rtruediv__ = __truediv__
28
29 @property
30 def numerator(self):
31 return DummyIntegral(self)
32
33 @property
34 def denominator(self):
35 return DummyIntegral(1)
36
37
38class HashTest(unittest.TestCase):

Callers 4

__mul__Method · 0.85
numeratorMethod · 0.85
denominatorMethod · 0.85
test_fractionsMethod · 0.85

Calls

no outgoing calls

Tested by 4

__mul__Method · 0.68
numeratorMethod · 0.68
denominatorMethod · 0.68
test_fractionsMethod · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…