diff options
author | Tim Peters <tim.peters@gmail.com> | 2001-09-03 08:35:41 (GMT) |
---|---|---|
committer | Tim Peters <tim.peters@gmail.com> | 2001-09-03 08:35:41 (GMT) |
commit | 32f453eaa476c78376cd721d29ba8ab726e400bb (patch) | |
tree | aec8b2e54ec4a0a7cbd66569d3a8531db118f153 /Lib/test/test_long.py | |
parent | 5d2b77cf31c5a3cbabc74936831480b9caea3a12 (diff) | |
download | cpython-32f453eaa476c78376cd721d29ba8ab726e400bb.zip cpython-32f453eaa476c78376cd721d29ba8ab726e400bb.tar.gz cpython-32f453eaa476c78376cd721d29ba8ab726e400bb.tar.bz2 |
New restriction on pow(x, y, z): If z is not None, x and y must be of
integer types, and y must be >= 0. See discussion at
http://sf.net/tracker/index.php?func=detail&aid=457066&group_id=5470&atid=105470
Diffstat (limited to 'Lib/test/test_long.py')
-rw-r--r-- | Lib/test/test_long.py | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/Lib/test/test_long.py b/Lib/test/test_long.py index 3b6081e..b0eaff7 100644 --- a/Lib/test/test_long.py +++ b/Lib/test/test_long.py @@ -314,10 +314,19 @@ def test_auto_overflow(): checkit(x, '**', y) for z in special: - if z != 0: - expected = pow(longx, longy, long(z)) - got = pow(x, y, z) - checkit('pow', x, y, '%', z) + if z != 0 : + if y >= 0: + expected = pow(longx, longy, long(z)) + got = pow(x, y, z) + checkit('pow', x, y, '%', z) + else: + try: + pow(longx, longy, long(z)) + except TypeError: + pass + else: + raise TestFailed("pow%r should have raised " + "TypeError" % ((longx, longy, long(z)))) # ---------------------------------------------------------------- do it |