MCPcopy
hub / github.com/numpy/numpy / test_fillvalue_conversion

Method test_fillvalue_conversion

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

Source from the content-addressed store, hash-verified

2362 assert_equal(fval.item(), (-999999999,))
2363
2364 def test_fillvalue_conversion(self):
2365 # Tests the behavior of fill_value during conversion
2366 # We had a tailored comment to make sure special attributes are
2367 # properly dealt with
2368 a = array([b'3', b'4', b'5'])
2369 a._optinfo.update({'comment': "updated!"})
2370
2371 b = array(a, dtype=int)
2372 assert_equal(b._data, [3, 4, 5])
2373 assert_equal(b.fill_value, default_fill_value(0))
2374
2375 b = array(a, dtype=float)
2376 assert_equal(b._data, [3, 4, 5])
2377 assert_equal(b.fill_value, default_fill_value(0.))
2378
2379 b = a.astype(int)
2380 assert_equal(b._data, [3, 4, 5])
2381 assert_equal(b.fill_value, default_fill_value(0))
2382 assert_equal(b._optinfo['comment'], "updated!")
2383
2384 b = a.astype([('a', '|S3')])
2385 assert_equal(b['a']._data, a._data)
2386 assert_equal(b['a'].fill_value, a.fill_value)
2387
2388 def test_default_fill_value(self):
2389 # 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