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

Method test_union1d

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

Source from the content-addressed store, hash-verified

571 assert_array_equal(result, [True] + [False] * 4)
572
573 def test_union1d(self):
574 a = np.array([5, 4, 7, 1, 2])
575 b = np.array([2, 4, 3, 3, 2, 1, 5])
576
577 ec = np.array([1, 2, 3, 4, 5, 7])
578 c = union1d(a, b)
579 assert_array_equal(c, ec)
580
581 # Tests gh-10340, arguments to union1d should be
582 # flattened if they are not already 1D
583 x = np.array([[0, 1, 2], [3, 4, 5]])
584 y = np.array([0, 1, 2, 3, 4])
585 ez = np.array([0, 1, 2, 3, 4, 5])
586 z = union1d(x, y)
587 assert_array_equal(z, ez)
588
589 assert_array_equal([], union1d([], []))
590
591 def test_setdiff1d(self):
592 a = np.array([6, 5, 4, 7, 1, 2, 7, 4])

Callers

nothing calls this directly

Calls 2

union1dFunction · 0.90
assert_array_equalFunction · 0.90

Tested by

no test coverage detected