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

Method test_unique_onmaskedarray

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

Source from the content-addressed store, hash-verified

1475 assert_equal(test[2], [0, 0, 0, 1, 1, 2])
1476
1477 def test_unique_onmaskedarray(self):
1478 # Test unique on masked data w/use_mask=True
1479 data = masked_array([1, 1, 1, 2, 2, 3], mask=[0, 0, 1, 0, 1, 0])
1480 test = unique(data, return_index=True, return_inverse=True)
1481 assert_equal(test[0], masked_array([1, 2, 3, -1], mask=[0, 0, 0, 1]))
1482 assert_equal(test[1], [0, 3, 5, 2])
1483 assert_equal(test[2], [0, 0, 3, 1, 3, 2])
1484 #
1485 data.fill_value = 3
1486 data = masked_array(data=[1, 1, 1, 2, 2, 3],
1487 mask=[0, 0, 1, 0, 1, 0], fill_value=3)
1488 test = unique(data, return_index=True, return_inverse=True)
1489 assert_equal(test[0], masked_array([1, 2, 3, -1], mask=[0, 0, 0, 1]))
1490 assert_equal(test[1], [0, 3, 5, 2])
1491 assert_equal(test[2], [0, 0, 3, 1, 3, 2])
1492
1493 def test_unique_allmasked(self):
1494 # Test all masked

Callers

nothing calls this directly

Calls 2

uniqueFunction · 0.90
assert_equalFunction · 0.90

Tested by

no test coverage detected