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

Method test_upgrademapper

numpy/lib/tests/test__iotools.py:201–215  ·  view source on GitHub ↗

Tests updatemapper

(self)

Source from the content-addressed store, hash-verified

199 pass
200
201 def test_upgrademapper(self):
202 "Tests updatemapper"
203 dateparser = _bytes_to_date
204 _original_mapper = StringConverter._mapper[:]
205 try:
206 StringConverter.upgrade_mapper(dateparser, date(2000, 1, 1))
207 convert = StringConverter(dateparser, date(2000, 1, 1))
208 test = convert('2001-01-01')
209 assert_equal(test, date(2001, 1, 1))
210 test = convert('2009-01-01')
211 assert_equal(test, date(2009, 1, 1))
212 test = convert('')
213 assert_equal(test, date(2000, 1, 1))
214 finally:
215 StringConverter._mapper = _original_mapper
216
217 def test_string_to_object(self):
218 "Make sure that string-to-object functions are properly recognized"

Callers

nothing calls this directly

Calls 4

StringConverterClass · 0.90
assert_equalFunction · 0.90
upgrade_mapperMethod · 0.80
convertFunction · 0.50

Tested by

no test coverage detected