mirror of
https://github.com/python/cpython.git
synced 2025-10-10 00:43:41 +00:00
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.
This commit is contained in:
parent
d256271c55
commit
702ca4ffcb
2 changed files with 8 additions and 10 deletions
|
@ -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'")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue