diff options
author | Raymond Hettinger <python@rcn.com> | 2002-08-19 03:19:09 +0000 |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2002-08-19 03:19:09 +0000 |
commit | caf9f75629d7ac86f065500e1639c5bd6422a7df (patch) | |
tree | f3eca5c5e34ab792fc34416335a326e6c1635ad7 /Lib/test/test_operator.py | |
parent | 3af09eda96ee749ff270c9edf92da8b1df19d879 (diff) | |
download | cpython-caf9f75629d7ac86f065500e1639c5bd6422a7df.tar.gz |
Added __pow__(a,b) to the operator module. Completes the pattern of
all operators having a counterpart in the operator module.
Closes SF bug #577513.
Diffstat (limited to 'Lib/test/test_operator.py')
-rw-r--r-- | Lib/test/test_operator.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/test/test_operator.py b/Lib/test/test_operator.py index f1e2959545..611e4277ff 100644 --- a/Lib/test/test_operator.py +++ b/Lib/test/test_operator.py @@ -161,6 +161,12 @@ class OperatorTestCase(unittest.TestCase): self.failUnless(operator.pos(0) == 0) self.failUnless(operator.pos(-0) == 0) + def test_pow(self): + self.failUnless(operator.pow(3,5) == 3**5) + self.failUnless(operator.__pow__(3,5) == 3**5) + self.assertRaises(TypeError, operator.pow, 1) + self.assertRaises(TypeError, operator.pow, 1, 2, 3) + def test_repeat(self): a = range(3) self.failUnless(operator.repeat(a, 2) == a+a) |