mirror of
https://github.com/python/cpython.git
synced 2026-01-26 21:03:34 +00:00
GH-102341: Improve the test function for pow (GH-102342)
(cherry picked from commit 32220543e2db36c6146ff2704ed1714a6adecc1b) Co-authored-by: Partha P. Mukherjee <ppm.floss@gmail.com> Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
This commit is contained in:
parent
c957128b48
commit
db8d10beb3
@ -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):
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user