本文整理汇总了Python中operator.imod方法的典型用法代码示例。如果您正苦于以下问题:Python operator.imod方法的具体用法?Python operator.imod怎么用?Python operator.imod使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类operator
的用法示例。
在下文中一共展示了operator.imod方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testIMod
# 需要导入模块: import operator [as 别名]
# 或者: from operator import imod [as 别名]
def testIMod(self):
self.augmentedAssignCheck(operator.imod, jmin=1)
示例2: test_imod_array
# 需要导入模块: import operator [as 别名]
# 或者: from operator import imod [as 别名]
def test_imod_array(self):
with testing.NumpyError(divide='ignore', invalid='ignore'):
self.check_array_array_op(operator.imod)
示例3: test_broadcasted_imod
# 需要导入模块: import operator [as 别名]
# 或者: from operator import imod [as 别名]
def test_broadcasted_imod(self):
with testing.NumpyError(divide='ignore', invalid='ignore'):
self.check_array_broadcasted_op(operator.imod)
示例4: _test_errors
# 需要导入模块: import operator [as 别名]
# 或者: from operator import imod [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)
示例5: __imod__
# 需要导入模块: import operator [as 别名]
# 或者: from operator import imod [as 别名]
def __imod__(self, other):
return Expression((self, other), operator.imod)
示例6: __imod__
# 需要导入模块: import operator [as 别名]
# 或者: from operator import imod [as 别名]
def __imod__(self, other):
return operator.imod(self._wrapped(), other)
示例7: test_inplace
# 需要导入模块: import operator [as 别名]
# 或者: from operator import imod [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")