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

Method test_ediff1d

numpy/lib/tests/test_arraysetops.py:128–145  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

126 assert_array_equal(c, ec)
127
128 def test_ediff1d(self):
129 zero_elem = np.array([])
130 one_elem = np.array([1])
131 two_elem = np.array([1, 2])
132
133 assert_array_equal([], ediff1d(zero_elem))
134 assert_array_equal([0], ediff1d(zero_elem, to_begin=0))
135 assert_array_equal([0], ediff1d(zero_elem, to_end=0))
136 assert_array_equal([-1, 0], ediff1d(zero_elem, to_begin=-1, to_end=0))
137 assert_array_equal([], ediff1d(one_elem))
138 assert_array_equal([1], ediff1d(two_elem))
139 assert_array_equal([7, 1, 9], ediff1d(two_elem, to_begin=7, to_end=9))
140 assert_array_equal([5, 6, 1, 7, 8],
141 ediff1d(two_elem, to_begin=[5, 6], to_end=[7, 8]))
142 assert_array_equal([1, 9], ediff1d(two_elem, to_end=9))
143 assert_array_equal([1, 7, 8], ediff1d(two_elem, to_end=[7, 8]))
144 assert_array_equal([7, 1], ediff1d(two_elem, to_begin=7))
145 assert_array_equal([5, 6, 1], ediff1d(two_elem, to_begin=[5, 6]))
146
147 @pytest.mark.parametrize("ary, prepend, append, expected", [
148 # should fail because trying to cast

Callers

nothing calls this directly

Calls 2

assert_array_equalFunction · 0.90
ediff1dFunction · 0.90

Tested by

no test coverage detected