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

Method test_reduce

numpy/core/tests/test_umath.py:2616–2631  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2614 assert_equal(np.bitwise_xor(arg1, arg2), out)
2615
2616 def test_reduce(self):
2617 none = np.array([0, 0, 0, 0], bool)
2618 some = np.array([1, 0, 1, 1], bool)
2619 every = np.array([1, 1, 1, 1], bool)
2620 empty = np.array([], bool)
2621
2622 arrs = [none, some, every, empty]
2623
2624 for arr in arrs:
2625 assert_equal(np.logical_and.reduce(arr), all(arr))
2626
2627 for arr in arrs:
2628 assert_equal(np.logical_or.reduce(arr), any(arr))
2629
2630 for arr in arrs:
2631 assert_equal(np.logical_xor.reduce(arr), arr.sum() % 2 == 1)
2632
2633
2634class TestBitwiseUFuncs:

Callers

nothing calls this directly

Calls 5

assert_equalFunction · 0.90
allFunction · 0.50
anyFunction · 0.50
reduceMethod · 0.45
sumMethod · 0.45

Tested by

no test coverage detected