MCPcopy Index your code
hub / github.com/python/cpython / test_codec_known_encoding

Method test_codec_known_encoding

Lib/test/test_capi/test_codecs.py:618–635  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

616 self.assertRaises(LookupError, codecs.lookup, encoding)
617
618 def test_codec_known_encoding(self):
619 self.assertRaises(LookupError, codecs.lookup, 'unknown-codec')
620 self.assertFalse(_testcapi.codec_known_encoding('unknown-codec'))
621 self.assertFalse(_testcapi.codec_known_encoding('unknown_codec'))
622 self.assertFalse(_testcapi.codec_known_encoding('UNKNOWN-codec'))
623
624 encoding_name = self.encoding_name
625 self.assertRaises(LookupError, codecs.lookup, encoding_name)
626
627 codecs.register(self.search_function)
628 self.addCleanup(codecs.unregister, self.search_function)
629
630 for name in [
631 encoding_name,
632 encoding_name.upper(),
633 ]:
634 with self.subTest(name):
635 self.assertTrue(_testcapi.codec_known_encoding(name))
636
637 def test_codec_encode(self):
638 encode = _testcapi.codec_encode

Callers

nothing calls this directly

Calls 7

assertFalseMethod · 0.80
addCleanupMethod · 0.80
assertTrueMethod · 0.80
assertRaisesMethod · 0.45
registerMethod · 0.45
upperMethod · 0.45
subTestMethod · 0.45

Tested by

no test coverage detected