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

Method test_converters_decode

numpy/lib/tests/test_io.py:689–697  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

687 assert_array_equal(v, np.array(utf16.decode('UTF-16').split()))
688
689 def test_converters_decode(self):
690 # test converters that decode strings
691 c = TextIO()
692 c.write(b'\xcf\x96')
693 c.seek(0)
694 x = self.loadfunc(c, dtype=np.str_,
695 converters={0: lambda x: x.decode('UTF-8')})
696 a = np.array([b'\xcf\x96'.decode('UTF-8')])
697 assert_array_equal(x, a)
698
699 def test_converters_nodecode(self):
700 # test native string converters enabled by setting an encoding

Callers

nothing calls this directly

Calls 5

writeMethod · 0.95
assert_array_equalFunction · 0.90
TextIOClass · 0.85
seekMethod · 0.80
decodeMethod · 0.80

Tested by

no test coverage detected