MCPcopy Create free account
hub / github.com/numpy/numpy / _test_lcm_inner

Method _test_lcm_inner

numpy/core/tests/test_umath.py:3977–3996  ·  view source on GitHub ↗
(self, dtype)

Source from the content-addressed store, hash-verified

3975 self._test_gcd_inner(np.object_)
3976
3977 def _test_lcm_inner(self, dtype):
3978 # basic use
3979 a = np.array([12, 120], dtype=dtype)
3980 b = np.array([20, 200], dtype=dtype)
3981 assert_equal(np.lcm(a, b), [60, 600])
3982
3983 if not issubclass(dtype, np.unsignedinteger):
3984 # negatives are ignored
3985 a = np.array([12, -12, 12, -12], dtype=dtype)
3986 b = np.array([20, 20, -20, -20], dtype=dtype)
3987 assert_equal(np.lcm(a, b), [60]*4)
3988
3989 # reduce
3990 a = np.array([3, 12, 20], dtype=dtype)
3991 assert_equal(np.lcm.reduce([3, 12, 20]), 60)
3992
3993 # broadcasting, and a test including 0
3994 a = np.arange(6).astype(dtype)
3995 b = 20
3996 assert_equal(np.lcm(a, b), [0, 20, 20, 60, 20, 20])
3997
3998 def _test_gcd_inner(self, dtype):
3999 # basic use

Callers 3

test_lcmMethod · 0.95
test_lcm_objectMethod · 0.95
test_gcdMethod · 0.95

Calls 3

assert_equalFunction · 0.90
astypeMethod · 0.80
reduceMethod · 0.45

Tested by

no test coverage detected