summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPartha P. Mukherjee <ppm.floss@gmail.com>2023-03-05 12:31:26 -0500
committerGitHub <noreply@github.com>2023-03-05 12:31:26 -0500
commit32220543e2db36c6146ff2704ed1714a6adecc1b (patch)
treee31fccd08e45b4a042ec09c78ceef557c9fe447a
parent7894bbe94ba319eb650f383cb5196424c77b2cfd (diff)
downloadcpython-git-32220543e2db36c6146ff2704ed1714a6adecc1b.tar.gz
GH-102341: Improve the test function for pow (#102342)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
-rw-r--r--Lib/test/test_pow.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/Lib/test/test_pow.py b/Lib/test/test_pow.py
index 5cea9ceb20..eeb482ec4b 100644
--- a/Lib/test/test_pow.py
+++ b/Lib/test/test_pow.py
@@ -19,12 +19,11 @@ class PowTest(unittest.TestCase):
self.assertEqual(pow(2, i), pow2)
if i != 30 : pow2 = pow2*2
- for othertype in (int,):
- for i in list(range(-10, 0)) + list(range(1, 10)):
- ii = type(i)
- for j in range(1, 11):
- jj = -othertype(j)
- pow(ii, jj)
+ for i in list(range(-10, 0)) + list(range(1, 10)):
+ ii = type(i)
+ inv = pow(ii, -1) # inverse of ii
+ for jj in range(-10, 0):
+ self.assertAlmostEqual(pow(ii, jj), pow(inv, -jj))
for othertype in int, float:
for i in range(1, 100):