Commit d256271c authored by Fred Drake's avatar Fred Drake

Added a regression test for the negation-of-exponentiation optimization

bug from compile.c.  (SF bug #456756.)
parent 14ef244d
import sys
import test_support
from test_support import verify
def powtest(type):
if type != float:
print " Testing 2-argument pow() function..."
......@@ -76,6 +79,14 @@ powtest(long)
print 'Testing floating point mode...'
powtest(float)
# Make sure '**' does the right thing; these form a
# regression test for SourceForge bug #456756.
#
verify((-2 ** 2) == -4,
"expected '-2 ** 2' to be -4, got %s" % (-2 ** 2))
verify(((-2) ** 2) == 4,
"expected '(-2) ** 2' to be 4, got %s" % ((-2) ** 2))
# Other tests-- not very systematic
print 'The number in both columns should match.'
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment