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

Method test_upgrademapper

numpy/lib/tests/test__iotools.py:206–220  ·  view source on GitHub ↗

Tests updatemapper

(self)

Source from the content-addressed store, hash-verified

204
205 @pytest.mark.thread_unsafe(reason="monkeypatches StringConverter")
206 def test_upgrademapper(self):
207 "Tests updatemapper"
208 dateparser = _bytes_to_date
209 _original_mapper = StringConverter._mapper[:]
210 try:
211 StringConverter.upgrade_mapper(dateparser, date(2000, 1, 1))
212 convert = StringConverter(dateparser, date(2000, 1, 1))
213 test = convert('2001-01-01')
214 assert_equal(test, date(2001, 1, 1))
215 test = convert('2009-01-01')
216 assert_equal(test, date(2009, 1, 1))
217 test = convert('')
218 assert_equal(test, date(2000, 1, 1))
219 finally:
220 StringConverter._mapper = _original_mapper
221
222 def test_string_to_object(self):
223 "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