Lines Matching refs:codecs
2 import sys, codecs, htmlentitydefs, unicodedata
113 codecs.register_error(
141 codecs.register_error(
188 codecs.register_error("test.relaxedutf8", relaxedutf8)
208 self.assertEqual(codecs.charmap_encode(sin, "strict", charmap)[0], sout)
211 self.assertRaises(UnicodeError, codecs.charmap_encode, sin, "strict", charmap)
216 self.assertEqual(codecs.charmap_encode(sin, "replace", charmap)[0], sout)
219 self.assertRaises(TypeError, codecs.charmap_encode, sin, "replace", charmap)
222 self.assertRaises(TypeError, codecs.charmap_encode, sin, "replace", charmap)
246 codecs.register_error("test.hui", handler_unicodeinternal)
261 codecs.register_error("test.handler1", handler1)
269 codecs.register_error("test.handler2", handler2)
293 codecs.charmap_decode("abc", "test.handler1", {ord("a"): u"z"})[0],
314 codecs.register_error("test." + err, codecs.lookup_error(err))
428 codecs.strict_errors,
434 codecs.strict_errors,
441 codecs.strict_errors,
446 codecs.strict_errors,
451 codecs.strict_errors,
459 codecs.ignore_errors,
465 codecs.ignore_errors,
470 codecs.ignore_errors(
475 codecs.ignore_errors(
480 codecs.ignore_errors(
489 codecs.replace_errors,
495 codecs.replace_errors,
500 codecs.replace_errors,
505 codecs.replace_errors,
510 codecs.replace_errors(
515 codecs.replace_errors(
520 codecs.replace_errors(
529 codecs.xmlcharrefreplace_errors,
535 codecs.xmlcharrefreplace_errors,
541 codecs.xmlcharrefreplace_errors,
546 codecs.xmlcharrefreplace_errors,
556 codecs.xmlcharrefreplace_errors(
567 codecs.backslashreplace_errors,
573 codecs.backslashreplace_errors,
579 codecs.backslashreplace_errors,
584 codecs.backslashreplace_errors,
612 codecs.backslashreplace_errors(
623 codecs.register_error("test.badhandler", lambda x: res)
645 self.assertEqual(codecs.strict_errors, codecs.lookup_error("strict"))
646 self.assertEqual(codecs.ignore_errors, codecs.lookup_error("ignore"))
647 self.assertEqual(codecs.strict_errors, codecs.lookup_error("strict"))
649 codecs.xmlcharrefreplace_errors,
650 codecs.lookup_error("xmlcharrefreplace")
653 codecs.backslashreplace_errors,
654 codecs.lookup_error("backslashreplace")
663 codecs.register_error("test.unencreplhandler", unencrepl)
676 self.assertRaises(TypeError, codecs.register_error, 42)
677 self.assertRaises(TypeError, codecs.register_error, "test.dummy", 42)
682 self.assertRaises(TypeError, codecs.lookup_error)
687 self.assertRaises(LookupError, codecs.lookup_error, "test.unknown")
697 codecs.register_error("test.xmlcharrefreplace", codecs.xmlcharrefreplace_errors)
710 codecs.register_error("test.baddecodereturn1", baddecodereturn1)
720 codecs.register_error("test.baddecodereturn2", baddecodereturn2)
724 codecs.register_error("test.posreturn", handler.handle)
757 self.assertRaises(UnicodeError, codecs.charmap_decode, "\xff", "strict", {0xff: None})
758 self.assertRaises(ValueError, codecs.charmap_decode, "\xff", "strict", D())
759 self.assertRaises(TypeError, codecs.charmap_decode, "\xff", "strict", {0xff: 0x110000})
769 codecs.register_error("test.badencodereturn1", badencodereturn1)
774 codecs.register_error("test.badencodereturn2", badencodereturn2)
778 codecs.register_error("test.posreturn", handler.handle)
810 self.assertRaises(UnicodeError, codecs.charmap_encode, u"\xff", err, {0xff: None})
811 self.assertRaises(ValueError, codecs.charmap_encode, u"\xff", err, D())
812 self.assertRaises(TypeError, codecs.charmap_encode, u"\xff", err, {0xff: 300})
841 codecs.strict_errors,
842 codecs.ignore_errors,
843 codecs.replace_errors,
844 codecs.backslashreplace_errors,
845 codecs.xmlcharrefreplace_errors,