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

Method test_defaults

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 2

stack_arraysFunction · 0.90
assert_equalFunction · 0.90

Tested by

no test coverage detected