diff options
author | Fred Drake <fdrake@acm.org> | 2001-08-30 19:15:20 (GMT) |
---|---|---|
committer | Fred Drake <fdrake@acm.org> | 2001-08-30 19:15:20 (GMT) |
commit | 702ca4ffcb4630dad3aa2967618777e0f44a1e3c (patch) | |
tree | 3b13e210333e86da7b5fd1aa9f71753437fce35c /Lib/test/test_unary.py | |
parent | d256271c552cd021a91732ddc31552ade6cdf79f (diff) | |
download | cpython-702ca4ffcb4630dad3aa2967618777e0f44a1e3c.zip cpython-702ca4ffcb4630dad3aa2967618777e0f44a1e3c.tar.gz cpython-702ca4ffcb4630dad3aa2967618777e0f44a1e3c.tar.bz2 |
Revert the previous patch to test_pow.py and move the test to test_unary.py
based on a suggestion from Tim Peters; also make sure that we're really
doing exponentiation and not multiplication.
Diffstat (limited to 'Lib/test/test_unary.py')
-rw-r--r-- | Lib/test/test_unary.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/test_unary.py b/Lib/test/test_unary.py index 3402c55..01c5f01 100644 --- a/Lib/test/test_unary.py +++ b/Lib/test/test_unary.py @@ -33,6 +33,14 @@ class UnaryOpTestCase(unittest.TestCase): self.assert_(eval("-" + nines) == eval("-" + nines + "L")) self.assert_(eval("~" + nines) == eval("~" + nines + "L")) + def test_negation_of_exponentiation(self): + # Make sure '**' does the right thing; these form a + # regression test for SourceForge bug #456756. + self.assertEqual(-2 ** 3, -8) + self.assertEqual((-2) ** 3, -8) + self.assertEqual(-2 ** 4, -16) + self.assertEqual((-2) ** 4, 16) + def test_bad_types(self): for op in '+', '-', '~': self.assertRaises(TypeError, eval, op + "'a'") |