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

Method test_pow_uses_cached_small_ints

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 2

powFunction · 0.50
assertIsMethod · 0.45

Tested by

no test coverage detected