MCPcopy Create free account
hub / github.com/pexpect/pexpect / test_decoding_errors

Method test_decoding_errors

tests/test_screen.py:234–245  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

232 assert s.pretty() == unicode_box_pretty_result
233
234 def test_decoding_errors(self):
235 # With strict error handling, it should reject bytes it can't decode
236 with self.assertRaises(UnicodeDecodeError):
237 self.make_screen_with_box_cp437('ascii', 'strict')
238
239 # replace should turn them into unicode replacement characters, U+FFFD
240 s = self.make_screen_with_box_cp437('ascii', 'replace')
241 expected = u'\ufffd\ufffd\n\ufffd\ufffd'
242 if PY3:
243 assert str(s) == expected
244 else:
245 assert unicode(s) == expected
246
247 def test_unicode_cp437 (self):
248 # Verify decoding from and re-encoding to CP437.

Callers

nothing calls this directly

Calls 2

assertRaisesMethod · 0.80

Tested by

no test coverage detected