Python operator.__pow__() Examples
The following are 10
code examples of operator.__pow__().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
operator
, or try the search function
.
Example #1
Source File: test_operator.py From ironpython2 with Apache License 2.0 | 5 votes |
def test_pow(self): self.assertRaises(TypeError, operator.pow) self.assertRaises(TypeError, operator.pow, None, None) self.assertTrue(operator.pow(3,5) == 3**5) self.assertTrue(operator.__pow__(3,5) == 3**5) self.assertRaises(TypeError, operator.pow, 1) self.assertRaises(TypeError, operator.pow, 1, 2, 3)
Example #2
Source File: test_operator.py From BinderFilter with MIT License | 5 votes |
def test_pow(self): self.assertRaises(TypeError, operator.pow) self.assertRaises(TypeError, operator.pow, None, None) self.assertTrue(operator.pow(3,5) == 3**5) self.assertTrue(operator.__pow__(3,5) == 3**5) self.assertRaises(TypeError, operator.pow, 1) self.assertRaises(TypeError, operator.pow, 1, 2, 3)
Example #3
Source File: test_operator.py From oss-ftp with MIT License | 5 votes |
def test_pow(self): self.assertRaises(TypeError, operator.pow) self.assertRaises(TypeError, operator.pow, None, None) self.assertTrue(operator.pow(3,5) == 3**5) self.assertTrue(operator.__pow__(3,5) == 3**5) self.assertRaises(TypeError, operator.pow, 1) self.assertRaises(TypeError, operator.pow, 1, 2, 3)
Example #4
Source File: lineroot.py From backtrader with GNU General Public License v3.0 | 5 votes |
def __pow__(self, other): return self._operation(other, operator.__pow__)
Example #5
Source File: lineroot.py From backtrader with GNU General Public License v3.0 | 5 votes |
def __rpow__(self, other): return self._roperation(other, operator.__pow__)
Example #6
Source File: Pbinop.py From supriya with MIT License | 5 votes |
def _string_to_operator(self): operators = { "+": operator.__add__, "-": operator.__sub__, "*": operator.__mul__, "**": operator.__pow__, "/": operator.__truediv__, "//": operator.__floordiv__, } return operators[self.operator] ### PUBLIC PROPERTIES ###
Example #7
Source File: test_operator.py From gcblue with BSD 3-Clause "New" or "Revised" License | 5 votes |
def test_pow(self): self.assertRaises(TypeError, operator.pow) self.assertRaises(TypeError, operator.pow, None, None) self.assertTrue(operator.pow(3,5) == 3**5) self.assertTrue(operator.__pow__(3,5) == 3**5) self.assertRaises(TypeError, operator.pow, 1) self.assertRaises(TypeError, operator.pow, 1, 2, 3)
Example #8
Source File: test_operator.py From medicare-demo with Apache License 2.0 | 5 votes |
def test_pow(self): self.failUnlessRaises(TypeError, operator.pow) self.failUnlessRaises(TypeError, operator.pow, None, None) 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)
Example #9
Source File: test_operator.py From CTFCrackTools-V2 with GNU General Public License v3.0 | 5 votes |
def test_pow(self): self.failUnlessRaises(TypeError, operator.pow) self.failUnlessRaises(TypeError, operator.pow, None, None) 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)
Example #10
Source File: test_operator.py From CTFCrackTools with GNU General Public License v3.0 | 5 votes |
def test_pow(self): self.failUnlessRaises(TypeError, operator.pow) self.failUnlessRaises(TypeError, operator.pow, None, None) 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)