Skip to content

Commit abd37ac

Browse files
committed
Add smoke test for multibyte codec
1 parent 7051ee4 commit abd37ac

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

graalpython/com.oracle.graal.python.test/src/tests/test_codecs.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2019, 2023, Oracle and/or its affiliates.
1+
# Copyright (c) 2019, 2024, Oracle and/or its affiliates.
22
# Copyright (C) 1996-2017 Python Software Foundation
33
#
44
# Licensed under the PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2
@@ -863,5 +863,17 @@ def test_encode_dict_err_xmlcharrefreplace(self):
863863
self.assertEqual((b'\x00\r\x0c\x0b\n\x0e\r\x0c\x0b\x0b\x0e\x01', 4), codecs.charmap_encode('abcd', 'xmlcharrefreplace', codecs.charmap_build('ad0123456789#&;')))
864864

865865

866+
class MultibyteCodecTest(unittest.TestCase):
867+
868+
# just a smoke test
869+
def test_encode(self):
870+
import _codecs_tw
871+
codec = _codecs_tw.getcodec('big5')
872+
873+
self.assertEqual((b'', 0), codec.encode(""))
874+
self.assertRaises(TypeError, codec.encode)
875+
self.assertRaises(UnicodeEncodeError, codec.encode, '\xffff')
876+
877+
866878
if __name__ == '__main__':
867879
unittest.main()

0 commit comments

Comments
 (0)