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

Method test_unique_onmaskedarray

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

Source from the content-addressed store, hash-verified

1519 assert_equal(test[2], [0, 0, 0, 1, 1, 2])
1520
1521 def test_unique_onmaskedarray(self):
1522 # Test unique on masked data w/use_mask=True
1523 data = masked_array([1, 1, 1, 2, 2, 3], mask=[0, 0, 1, 0, 1, 0])
1524 test = unique(data, return_index=True, return_inverse=True)
1525 assert_equal(test[0], masked_array([1, 2, 3, -1], mask=[0, 0, 0, 1]))
1526 assert_equal(test[1], [0, 3, 5, 2])
1527 assert_equal(test[2], [0, 0, 3, 1, 3, 2])
1528 #
1529 data.fill_value = 3
1530 data = masked_array(data=[1, 1, 1, 2, 2, 3],
1531 mask=[0, 0, 1, 0, 1, 0], fill_value=3)
1532 test = unique(data, return_index=True, return_inverse=True)
1533 assert_equal(test[0], masked_array([1, 2, 3, -1], mask=[0, 0, 0, 1]))
1534 assert_equal(test[1], [0, 3, 5, 2])
1535 assert_equal(test[2], [0, 0, 3, 1, 3, 2])
1536
1537 def test_unique_allmasked(self):
1538 # Test all masked

Callers

nothing calls this directly

Calls 2

uniqueFunction · 0.90
assert_equalFunction · 0.90

Tested by

no test coverage detected