diff options
| author | Jeffrey Yasskin <jyasskin@gmail.com> | 2007-09-07 15:15:49 (GMT) |
|---|---|---|
| committer | Jeffrey Yasskin <jyasskin@gmail.com> | 2007-09-07 15:15:49 (GMT) |
| commit | 3404b3ce2acfc550571f06e70526ff75a34effeb (patch) | |
| tree | f0d59f10296397ed947e970af4fdb8179c5aeef1 /Lib/test | |
| parent | aaaef110dcb58ded6257512997ddf270828dc409 (diff) | |
| download | cpython-3404b3ce2acfc550571f06e70526ff75a34effeb.zip cpython-3404b3ce2acfc550571f06e70526ff75a34effeb.tar.gz cpython-3404b3ce2acfc550571f06e70526ff75a34effeb.tar.bz2 | |
Check in some documentation tweaks for PEP 3141, add some tests, and implement
the promotion to complex on pow(negative, fraction).
Diffstat (limited to 'Lib/test')
| -rw-r--r-- | Lib/test/test_builtin.py | 4 | ||||
| -rw-r--r-- | Lib/test/test_complex.py | 8 | ||||
| -rw-r--r-- | Lib/test/test_descr.py | 5 |
3 files changed, 4 insertions, 13 deletions
diff --git a/Lib/test/test_builtin.py b/Lib/test/test_builtin.py index d9633af..b6b45ee 100644 --- a/Lib/test/test_builtin.py +++ b/Lib/test/test_builtin.py @@ -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) diff --git a/Lib/test/test_complex.py b/Lib/test/test_complex.py index b4082d9..5397ad6 100644 --- a/Lib/test/test_complex.py +++ b/Lib/test/test_complex.py @@ -1,13 +1,6 @@ import unittest, os from test import test_support -import warnings -warnings.filterwarnings( - "ignore", - category=DeprecationWarning, - message=".*complex divmod.*are deprecated" -) - from random import random # These tests ensure that complex math does the right thing @@ -108,6 +101,7 @@ class ComplexTest(unittest.TestCase): # % is no longer supported on complex numbers self.assertRaises(TypeError, (1+1j).__mod__, 0+0j) self.assertRaises(TypeError, lambda: (3.33+4.43j) % 0) + self.assertRaises(TypeError, (1+1j).__mod__, 4.3j) def test_divmod(self): self.assertRaises(TypeError, divmod, 1+1j, 1+0j) diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py index 47b647c..bfa6a64 100644 --- a/Lib/test/test_descr.py +++ b/Lib/test/test_descr.py @@ -3,13 +3,8 @@ from test.test_support import verify, vereq, verbose, TestFailed, TESTFN from test.test_support import get_original_stdout from copy import deepcopy -import warnings import types -warnings.filterwarnings("ignore", - r'complex divmod\(\), // and % are deprecated$', - DeprecationWarning, r'(<string>|%s)$' % __name__) - def veris(a, b): if a is not b: raise TestFailed("%r is %r" % (a, b)) |
