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

Function test_unicode_with_converter

numpy/lib/tests/test_loadtxt.py:289–300  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

287
288
289def test_unicode_with_converter():
290 txt = StringIO("cat,dog\nαβγ,δεζ\nabc,def\n")
291 conv = {0: lambda s: s.upper()}
292 res = np.loadtxt(
293 txt,
294 dtype=np.dtype("U12"),
295 converters=conv,
296 delimiter=",",
297 encoding=None
298 )
299 expected = np.array([['CAT', 'dog'], ['ΑΒΓ', 'δεζ'], ['ABC', 'def']])
300 assert_equal(res, expected)
301
302
303def test_converter_with_structured_dtype():

Callers

nothing calls this directly

Calls 3

assert_equalFunction · 0.90
upperMethod · 0.80
dtypeMethod · 0.45

Tested by

no test coverage detected