Skip to content

Commit

Permalink
pythonGH-102341: Improve the test function for pow (python#102342)
Browse files Browse the repository at this point in the history
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
  • Loading branch information
ppmfloss and terryjreedy authored Mar 5, 2023
1 parent 7894bbe commit 3222054
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions Lib/test/test_pow.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,11 @@ def powtest(self, type):
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):
Expand Down

0 comments on commit 3222054

Please sign in to comment.