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

Method test_defaults

numpy/lib/tests/test_recfunctions.py:728–743  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

726 assert_equal(test.mask, control.mask)
727
728 def test_defaults(self):
729 # Test defaults: no exception raised if keys of defaults are not fields.
730 z = self._create_arrays()[-1]
731 zz = np.array([('a', 10., 100.), ('b', 20., 200.), ('c', 30., 300.)],
732 dtype=[('A', '|S3'), ('B', float), ('C', float)])
733 defaults = {'A': '???', 'B': -999., 'C': -9999., 'D': -99999.}
734 test = stack_arrays((z, zz), defaults=defaults)
735 control = ma.array([('A', 1, -9999.), ('B', 2, -9999.),
736 (
737 'a', 10., 100.), ('b', 20., 200.), ('c', 30., 300.)],
738 dtype=[('A', '|S3'), ('B', float), ('C', float)],
739 mask=[(0, 0, 1), (0, 0, 1),
740 (0, 0, 0), (0, 0, 0), (0, 0, 0)])
741 assert_equal(test, control)
742 assert_equal(test.data, control.data)
743 assert_equal(test.mask, control.mask)
744
745 def test_autoconversion(self):
746 # Tests autoconversion

Callers

nothing calls this directly

Calls 3

_create_arraysMethod · 0.95
stack_arraysFunction · 0.90
assert_equalFunction · 0.90

Tested by

no test coverage detected