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

Method test_fillvalue_conversion

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

Source from the content-addressed store, hash-verified

2165 assert_equal(fval.item(), (-999999999,))
2166
2167 def test_fillvalue_conversion(self):
2168 # Tests the behavior of fill_value during conversion
2169 # We had a tailored comment to make sure special attributes are
2170 # properly dealt with
2171 a = array([b'3', b'4', b'5'])
2172 a._optinfo.update({'comment':"updated!"})
2173
2174 b = array(a, dtype=int)
2175 assert_equal(b._data, [3, 4, 5])
2176 assert_equal(b.fill_value, default_fill_value(0))
2177
2178 b = array(a, dtype=float)
2179 assert_equal(b._data, [3, 4, 5])
2180 assert_equal(b.fill_value, default_fill_value(0.))
2181
2182 b = a.astype(int)
2183 assert_equal(b._data, [3, 4, 5])
2184 assert_equal(b.fill_value, default_fill_value(0))
2185 assert_equal(b._optinfo['comment'], "updated!")
2186
2187 b = a.astype([('a', '|S3')])
2188 assert_equal(b['a']._data, a._data)
2189 assert_equal(b['a'].fill_value, a.fill_value)
2190
2191 def test_default_fill_value(self):
2192 # check all calling conventions

Callers

nothing calls this directly

Calls 5

arrayFunction · 0.90
assert_equalFunction · 0.90
default_fill_valueFunction · 0.90
updateMethod · 0.80
astypeMethod · 0.80

Tested by

no test coverage detected