This commit is contained in:
Stan Ulbrych 2025-12-08 06:11:21 +02:00 committed by GitHub
commit 83f5353598
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 76 additions and 20 deletions

View file

@ -3129,6 +3129,20 @@ def test_uu_invalid(self):
# Missing "begin" line
self.assertRaises(ValueError, codecs.decode, b"", "uu-codec")
def test_invalid_error_input(self):
for encoding in bytes_transform_encodings:
with self.subTest(encoding=encoding):
encoder = codecs.getencoder(encoding)
decoder = codecs.getdecoder(encoding)
self.assertRaises(ValueError, encoder, 'in', errors='notstrict')
self.assertRaises(ValueError, decoder, 'in', errors='notstrict')
incdev = codecs.getincrementaldecoder(encoding)
if encoding not in ('base64_codec', 'uu_codec', 'quopri_codec', 'hex_codec'):
self.assertRaises(ValueError, incdev, errors='notstrict')
# The codec system tries to add notes to exceptions in order to ensure
# the error mentions the operation being performed and the codec involved.