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

Method test_keep_default

numpy/lib/tests/test__iotools.py:229–241  ·  view source on GitHub ↗

Make sure we don't lose an explicit default

(self)

Source from the content-addressed store, hash-verified

227 assert_(hasattr(conv, 'default'))
228
229 def test_keep_default(self):
230 "Make sure we don't lose an explicit default"
231 converter = StringConverter(None, missing_values='',
232 default=-999)
233 converter.upgrade('3.14159265')
234 assert_equal(converter.default, -999)
235 assert_equal(converter.type, np.dtype(float))
236 #
237 converter = StringConverter(
238 None, missing_values='', default=0)
239 converter.upgrade('3.14159265')
240 assert_equal(converter.default, 0)
241 assert_equal(converter.type, np.dtype(float))
242
243 def test_keep_default_zero(self):
244 "Check that we don't lose a default of 0"

Callers

nothing calls this directly

Calls 4

upgradeMethod · 0.95
StringConverterClass · 0.90
assert_equalFunction · 0.90
dtypeMethod · 0.45

Tested by

no test coverage detected