MCPcopy Index your code
hub / github.com/RustPython/RustPython / check_encode_strings

Method check_encode_strings

Lib/test/test_codecs.py:3751–3763  ·  view source on GitHub ↗
(self, errors)

Source from the content-addressed store, hash-verified

3749 return _testinternalcapi.EncodeLocaleEx(text, 0, errors)
3750
3751 def check_encode_strings(self, errors):
3752 for text in self.STRINGS:
3753 with self.subTest(text=text):
3754 try:
3755 expected = text.encode(self.ENCODING, errors)
3756 except UnicodeEncodeError:
3757 with self.assertRaises(RuntimeError) as cm:
3758 self.encode(text, errors)
3759 errmsg = str(cm.exception)
3760 self.assertRegex(errmsg, r"encode error: pos=[0-9]+, reason=")
3761 else:
3762 encoded = self.encode(text, errors)
3763 self.assertEqual(encoded, expected)
3764
3765 def test_encode_strict(self):
3766 self.check_encode_strings("strict")

Callers 3

test_encode_strictMethod · 0.95

Calls 6

encodeMethod · 0.95
strFunction · 0.85
subTestMethod · 0.80
assertRegexMethod · 0.80
assertRaisesMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected