MCPcopy Index your code
hub / github.com/numpy/numpy / test_reduce

Method test_reduce

numpy/_core/tests/test_umath.py:2857–2872  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2855 assert_equal(np.bitwise_xor(arg1, arg2), out)
2856
2857 def test_reduce(self):
2858 none = np.array([0, 0, 0, 0], bool)
2859 some = np.array([1, 0, 1, 1], bool)
2860 every = np.array([1, 1, 1, 1], bool)
2861 empty = np.array([], bool)
2862
2863 arrs = [none, some, every, empty]
2864
2865 for arr in arrs:
2866 assert_equal(np.logical_and.reduce(arr), all(arr))
2867
2868 for arr in arrs:
2869 assert_equal(np.logical_or.reduce(arr), any(arr))
2870
2871 for arr in arrs:
2872 assert_equal(np.logical_xor.reduce(arr), arr.sum() % 2 == 1)
2873
2874
2875class TestBitwiseUFuncs:

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected