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

Method test_union1d

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

Source from the content-addressed store, hash-verified

561 assert_array_equal(result, [True] + [False] * 4)
562
563 def test_union1d(self):
564 a = np.array([5, 4, 7, 1, 2])
565 b = np.array([2, 4, 3, 3, 2, 1, 5])
566
567 ec = np.array([1, 2, 3, 4, 5, 7])
568 c = union1d(a, b)
569 assert_array_equal(c, ec)
570
571 # Tests gh-10340, arguments to union1d should be
572 # flattened if they are not already 1D
573 x = np.array([[0, 1, 2], [3, 4, 5]])
574 y = np.array([0, 1, 2, 3, 4])
575 ez = np.array([0, 1, 2, 3, 4, 5])
576 z = union1d(x, y)
577 assert_array_equal(z, ez)
578
579 assert_array_equal([], union1d([], []))
580
581 def test_setdiff1d(self):
582 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