[Python-checkins] CVS: python/dist/src/Lib/test test_pow.py,1.8,1.9
Fred L. Drake
fdrake@users.sourceforge.net
Thu, 30 Aug 2001 11:56:32 -0700
Update of /cvsroot/python/python/dist/src/Lib/test
In directory usw-pr-cvs1:/tmp/cvs-serv8624/Lib/test
Modified Files:
test_pow.py
Log Message:
Added a regression test for the negation-of-exponentiation optimization
bug from compile.c. (SF bug #456756.)
Index: test_pow.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_pow.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** test_pow.py 2001/07/12 12:51:22 1.8
--- test_pow.py 2001/08/30 18:56:30 1.9
***************
*** 2,5 ****
--- 2,8 ----
import test_support
+ from test_support import verify
+
+
def powtest(type):
if type != float:
***************
*** 76,79 ****
--- 79,90 ----
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