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

Method test_union1d

numpy/ma/tests/test_extras.py:1723–1739  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1721 assert_array_equal([], in1d([], [], invert=True))
1722
1723 def test_union1d(self):
1724 # Test union1d
1725 a = array([1, 2, 5, 7, 5, -1], mask=[0, 0, 0, 0, 0, 1])
1726 b = array([1, 2, 3, 4, 5, -1], mask=[0, 0, 0, 0, 0, 1])
1727 test = union1d(a, b)
1728 control = array([1, 2, 3, 4, 5, 7, -1], mask=[0, 0, 0, 0, 0, 0, 1])
1729 assert_equal(test, control)
1730
1731 # Tests gh-10340, arguments to union1d should be
1732 # flattened if they are not already 1D
1733 x = array([[0, 1, 2], [3, 4, 5]], mask=[[0, 0, 0], [0, 0, 1]])
1734 y = array([0, 1, 2, 3, 4], mask=[0, 0, 0, 0, 1])
1735 ez = array([0, 1, 2, 3, 4, 5], mask=[0, 0, 0, 0, 0, 1])
1736 z = union1d(x, y)
1737 assert_equal(z, ez)
1738 #
1739 assert_array_equal([], union1d([], []))
1740
1741 def test_setdiff1d(self):
1742 # Test setdiff1d

Callers

nothing calls this directly

Calls 4

arrayFunction · 0.90
union1dFunction · 0.90
assert_equalFunction · 0.90
assert_array_equalFunction · 0.90

Tested by

no test coverage detected