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

Method test_fillvalue_individual_fields

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

Source from the content-addressed store, hash-verified

2526 assert_equal(test[0], np.full(3, maximum_fill_value(a['value'])))
2527
2528 def test_fillvalue_individual_fields(self):
2529 # Test setting fill_value on individual fields
2530 ndtype = [('a', int), ('b', int)]
2531 # Explicit fill_value
2532 a = array(list(zip([1, 2, 3], [4, 5, 6])),
2533 fill_value=(-999, -999), dtype=ndtype)
2534 aa = a['a']
2535 aa.set_fill_value(10)
2536 assert_equal(aa._fill_value, np.array(10))
2537 assert_equal(tuple(a.fill_value), (10, -999))
2538 a.fill_value['b'] = -10
2539 assert_equal(tuple(a.fill_value), (10, -10))
2540 # Implicit fill_value
2541 t = array(list(zip([1, 2, 3], [4, 5, 6])), dtype=ndtype)
2542 tt = t['a']
2543 tt.set_fill_value(10)
2544 assert_equal(tt._fill_value, np.array(10))
2545 assert_equal(tuple(t.fill_value), (10, default_fill_value(0)))
2546
2547 def test_fillvalue_implicit_structured_array(self):
2548 # 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