mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Check in some documentation tweaks for PEP 3141, add some tests, and implement
the promotion to complex on pow(negative, fraction).
This commit is contained in:
parent
aaaef110dc
commit
3404b3ce2a
5 changed files with 68 additions and 33 deletions
|
@ -1358,11 +1358,13 @@ class BuiltinTest(unittest.TestCase):
|
|||
else:
|
||||
self.assertAlmostEqual(pow(x, y, z), 24.0)
|
||||
|
||||
self.assertAlmostEqual(pow(-1, 0.5), 1j)
|
||||
self.assertAlmostEqual(pow(-1, 1/3), 0.5 + 0.8660254037844386j)
|
||||
|
||||
self.assertRaises(TypeError, pow, -1, -2, 3)
|
||||
self.assertRaises(ValueError, pow, 1, 2, 0)
|
||||
self.assertRaises(TypeError, pow, -1, -2, 3)
|
||||
self.assertRaises(ValueError, pow, 1, 2, 0)
|
||||
self.assertRaises(ValueError, pow, -342.43, 0.234)
|
||||
|
||||
self.assertRaises(TypeError, pow)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue