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

Method test_pow_uses_cached_small_ints

Lib/test/test_long.py:1084–1098  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1082
1083 @support.cpython_only
1084 def test_pow_uses_cached_small_ints(self):
1085 self.assertIs(pow(10, 3, 998), 2)
1086 self.assertIs(10 ** 3 % 998, 2)
1087 a, p, m = 10, 3, 998
1088 self.assertIs(a ** p % m, 2)
1089
1090 self.assertIs(pow(2, 31, 2 ** 31 - 1), 1)
1091 self.assertIs(2 ** 31 % (2 ** 31 - 1), 1)
1092 a, p, m = 2, 31, 2 ** 31 - 1
1093 self.assertIs(a ** p % m, 1)
1094
1095 self.assertIs(pow(2, 100, 2**100 - 3), 3)
1096 self.assertIs(2 ** 100 % (2 ** 100 - 3), 3)
1097 a, p, m = 2, 100, 2**100 - 3
1098 self.assertIs(a ** p % m, 3)
1099
1100 @support.cpython_only
1101 def test_divmod_uses_cached_small_ints(self):

Callers

nothing calls this directly

Calls 2

powFunction · 0.85
assertIsMethod · 0.45

Tested by

no test coverage detected