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

Method test_fillvalue_individual_fields

numpy/ma/tests/test_core.py:2332–2349  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2330 assert_equal(test[0], np.full(3, maximum_fill_value(a['value'])))
2331
2332 def test_fillvalue_individual_fields(self):
2333 # Test setting fill_value on individual fields
2334 ndtype = [('a', int), ('b', int)]
2335 # Explicit fill_value
2336 a = array(list(zip([1, 2, 3], [4, 5, 6])),
2337 fill_value=(-999, -999), dtype=ndtype)
2338 aa = a['a']
2339 aa.set_fill_value(10)
2340 assert_equal(aa._fill_value, np.array(10))
2341 assert_equal(tuple(a.fill_value), (10, -999))
2342 a.fill_value['b'] = -10
2343 assert_equal(tuple(a.fill_value), (10, -10))
2344 # Implicit fill_value
2345 t = array(list(zip([1, 2, 3], [4, 5, 6])), dtype=ndtype)
2346 tt = t['a']
2347 tt.set_fill_value(10)
2348 assert_equal(tt._fill_value, np.array(10))
2349 assert_equal(tuple(t.fill_value), (10, default_fill_value(0)))
2350
2351 def test_fillvalue_implicit_structured_array(self):
2352 # Check that fill_value is always defined for structured arrays

Callers

nothing calls this directly

Calls 3

arrayFunction · 0.90
assert_equalFunction · 0.90
default_fill_valueFunction · 0.90

Tested by

no test coverage detected