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

Method test_union1d

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

Source from the content-addressed store, hash-verified

1658 assert_array_equal([], in1d([], [], invert=True))
1659
1660 def test_union1d(self):
1661 # Test union1d
1662 a = array([1, 2, 5, 7, 5, -1], mask=[0, 0, 0, 0, 0, 1])
1663 b = array([1, 2, 3, 4, 5, -1], mask=[0, 0, 0, 0, 0, 1])
1664 test = union1d(a, b)
1665 control = array([1, 2, 3, 4, 5, 7, -1], mask=[0, 0, 0, 0, 0, 0, 1])
1666 assert_equal(test, control)
1667
1668 # Tests gh-10340, arguments to union1d should be
1669 # flattened if they are not already 1D
1670 x = array([[0, 1, 2], [3, 4, 5]], mask=[[0, 0, 0], [0, 0, 1]])
1671 y = array([0, 1, 2, 3, 4], mask=[0, 0, 0, 0, 1])
1672 ez = array([0, 1, 2, 3, 4, 5], mask=[0, 0, 0, 0, 0, 1])
1673 z = union1d(x, y)
1674 assert_equal(z, ez)
1675 #
1676 assert_array_equal([], union1d([], []))
1677
1678 def test_setdiff1d(self):
1679 # 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