本文整理汇总了Python中operator.irshift方法的典型用法代码示例。如果您正苦于以下问题:Python operator.irshift方法的具体用法?Python operator.irshift怎么用?Python operator.irshift使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类operator
的用法示例。
在下文中一共展示了operator.irshift方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_operatorerrors
# 需要导入模块: import operator [as 别名]
# 或者: from operator import irshift [as 别名]
def test_operatorerrors(self):
f2 = self.f2
f2p = self.f2p
f256 = self.f256
f19 = self.f19
self.assertRaises(TypeError, operator.add, f2(1), f2p(2))
self.assertRaises(TypeError, operator.iadd, f2(1), f2p(2))
self.assertRaises(TypeError, operator.sub, f2(1), f256(2))
self.assertRaises(TypeError, operator.isub, f2(1), f256(2))
self.assertRaises(TypeError, operator.mul, f2(1), f19(2))
self.assertRaises(TypeError, operator.imul, f2(1), f19(2))
self.assertRaises(TypeError, operator.truediv, f256(1), f19(2))
self.assertRaises(TypeError, operator.itruediv, f256(1), f19(2))
self.assertRaises(TypeError, operator.truediv, 3.14, f19(2))
self.assertRaises(TypeError, operator.lshift, f2(1), f2(1))
self.assertRaises(TypeError, operator.ilshift, f2(1), f2(1))
self.assertRaises(TypeError, operator.lshift, 1, f2(1))
self.assertRaises(TypeError, operator.rshift, f19(1), f19(1))
self.assertRaises(TypeError, operator.irshift, f19(1), f19(1))
self.assertRaises(TypeError, operator.irshift, f256(1), f256(1))
self.assertRaises(TypeError, operator.pow, f2(1), f19(2))
self.assertRaises(TypeError, operator.pow, f19(1), 3.14)
示例2: testIRShift
# 需要导入模块: import operator [as 别名]
# 或者: from operator import irshift [as 别名]
def testIRShift(self):
self.augmentedAssignCheck(operator.irshift, jmax=256)
示例3: test_irshift_array
# 需要导入模块: import operator [as 别名]
# 或者: from operator import irshift [as 别名]
def test_irshift_array(self):
self.check_array_array_op(operator.irshift)
示例4: test_broadcasted_irshift
# 需要导入模块: import operator [as 别名]
# 或者: from operator import irshift [as 别名]
def test_broadcasted_irshift(self):
self.check_array_broadcasted_op(operator.irshift)
示例5: _test_errors
# 需要导入模块: import operator [as 别名]
# 或者: from operator import irshift [as 别名]
def _test_errors(self, poly):
self.assertRaises(ValueError, poly.from_terms, 'x**2')
self.assertRaises(TypeError, poly, 0.1)
self.assertRaises(TypeError, poly, gfpx.GFpX(257)(0))
self.assertRaises(ValueError, poly, [poly.p])
self.assertRaises(TypeError, operator.add, poly(0), 0.1)
self.assertRaises(TypeError, operator.iadd, poly(0), 0.1)
self.assertRaises(TypeError, operator.sub, poly(0), 0.1)
self.assertRaises(TypeError, operator.sub, 0.1, poly(0))
self.assertRaises(TypeError, operator.isub, poly(0), 0.1)
self.assertRaises(TypeError, operator.mul, poly(0), 0.1)
self.assertRaises(TypeError, operator.imul, poly(0), 0.1)
self.assertRaises(TypeError, operator.lshift, poly(0), 0.1)
self.assertRaises(TypeError, operator.lshift, 0.1, poly(0))
self.assertRaises(TypeError, operator.ilshift, poly(0), 0.1)
self.assertRaises(TypeError, operator.rshift, poly(0), 0.1)
self.assertRaises(TypeError, operator.rshift, 0.1, poly(0))
self.assertRaises(TypeError, operator.irshift, poly(0), 0.1)
self.assertRaises(TypeError, operator.floordiv, poly(0), 0.1)
self.assertRaises(TypeError, operator.floordiv, 0.1, poly(0))
self.assertRaises(TypeError, operator.ifloordiv, poly(0), 0.1)
self.assertRaises(TypeError, operator.mod, poly(0), 0.1)
self.assertRaises(TypeError, operator.mod, 0.1, poly(0))
self.assertRaises(TypeError, operator.imod, poly(0), 0.1)
self.assertRaises(TypeError, divmod, poly(0), 0.1)
self.assertRaises(TypeError, divmod, 0.1, poly(0))
self.assertRaises(TypeError, operator.lt, poly(0), 0.1)
self.assertRaises(TypeError, operator.lt, 0.1, poly(0)) # NB: tests >
self.assertRaises(TypeError, operator.le, poly(0), 0.1)
self.assertRaises(TypeError, operator.le, 0.1, poly(0)) # NB: tests <
self.assertRaises(ZeroDivisionError, poly.invert, poly(283), poly(0))
self.assertRaises(ZeroDivisionError, poly.invert, poly(283), poly(283))
self.assertRaises(ZeroDivisionError, poly.mod, poly(283), poly(0))
self.assertRaises(ZeroDivisionError, poly.divmod, poly(283), poly(0))
self.assertRaises(ValueError, operator.pow, poly(3), -16)
示例6: __irshift__
# 需要导入模块: import operator [as 别名]
# 或者: from operator import irshift [as 别名]
def __irshift__(self, other):
return Expression((self, other), operator.irshift)
示例7: __irshift__
# 需要导入模块: import operator [as 别名]
# 或者: from operator import irshift [as 别名]
def __irshift__(self, other):
return operator.irshift(self._wrapped(), other)
示例8: test_inplace
# 需要导入模块: import operator [as 别名]
# 或者: from operator import irshift [as 别名]
def test_inplace(self):
class C(object):
def __iadd__ (self, other): return "iadd"
def __iand__ (self, other): return "iand"
def __idiv__ (self, other): return "idiv"
def __ifloordiv__(self, other): return "ifloordiv"
def __ilshift__ (self, other): return "ilshift"
def __imod__ (self, other): return "imod"
def __imul__ (self, other): return "imul"
def __ior__ (self, other): return "ior"
def __ipow__ (self, other): return "ipow"
def __irshift__ (self, other): return "irshift"
def __isub__ (self, other): return "isub"
def __itruediv__ (self, other): return "itruediv"
def __ixor__ (self, other): return "ixor"
def __getitem__(self, other): return 5 # so that C is a sequence
c = C()
self.assertEqual(operator.iadd (c, 5), "iadd")
self.assertEqual(operator.iand (c, 5), "iand")
self.assertEqual(operator.idiv (c, 5), "idiv")
self.assertEqual(operator.ifloordiv(c, 5), "ifloordiv")
self.assertEqual(operator.ilshift (c, 5), "ilshift")
self.assertEqual(operator.imod (c, 5), "imod")
self.assertEqual(operator.imul (c, 5), "imul")
self.assertEqual(operator.ior (c, 5), "ior")
self.assertEqual(operator.ipow (c, 5), "ipow")
self.assertEqual(operator.irshift (c, 5), "irshift")
self.assertEqual(operator.isub (c, 5), "isub")
self.assertEqual(operator.itruediv (c, 5), "itruediv")
self.assertEqual(operator.ixor (c, 5), "ixor")
self.assertEqual(operator.iconcat (c, c), "iadd")
self.assertEqual(operator.irepeat (c, 5), "imul")
self.assertEqual(operator.__iadd__ (c, 5), "iadd")
self.assertEqual(operator.__iand__ (c, 5), "iand")
self.assertEqual(operator.__idiv__ (c, 5), "idiv")
self.assertEqual(operator.__ifloordiv__(c, 5), "ifloordiv")
self.assertEqual(operator.__ilshift__ (c, 5), "ilshift")
self.assertEqual(operator.__imod__ (c, 5), "imod")
self.assertEqual(operator.__imul__ (c, 5), "imul")
self.assertEqual(operator.__ior__ (c, 5), "ior")
self.assertEqual(operator.__ipow__ (c, 5), "ipow")
self.assertEqual(operator.__irshift__ (c, 5), "irshift")
self.assertEqual(operator.__isub__ (c, 5), "isub")
self.assertEqual(operator.__itruediv__ (c, 5), "itruediv")
self.assertEqual(operator.__ixor__ (c, 5), "ixor")
self.assertEqual(operator.__iconcat__ (c, c), "iadd")
self.assertEqual(operator.__irepeat__ (c, 5), "imul")