3
# Codec encoding tests for ISO 2022 encodings.
5
from test import support
6
from test import multibytecodec_support
11
(b'ab\xFFcd', 'replace', 'ab\uFFFDcd'),
12
(b'ab\x1Bdef', 'replace', 'ab\x1Bdef'),
13
(b'ab\x1B$def', 'replace', 'ab\uFFFD'),
16
class Test_ISO2022_JP(multibytecodec_support.TestBase, unittest.TestCase):
17
encoding = 'iso2022_jp'
18
tstring = multibytecodec_support.load_teststring('iso2022_jp')
19
codectests = COMMON_CODEC_TESTS + (
20
(b'ab\x1BNdef', 'replace', 'ab\x1BNdef'),
23
class Test_ISO2022_JP2(multibytecodec_support.TestBase, unittest.TestCase):
24
encoding = 'iso2022_jp_2'
25
tstring = multibytecodec_support.load_teststring('iso2022_jp')
26
codectests = COMMON_CODEC_TESTS + (
27
(b'ab\x1BNdef', 'replace', 'abdef'),
30
class Test_ISO2022_KR(multibytecodec_support.TestBase, unittest.TestCase):
31
encoding = 'iso2022_kr'
32
tstring = multibytecodec_support.load_teststring('iso2022_kr')
33
codectests = COMMON_CODEC_TESTS + (
34
(b'ab\x1BNdef', 'replace', 'ab\x1BNdef'),
37
# iso2022_kr.txt cannot be used to test "chunk coding": the escape
38
# sequence is only written on the first line
39
def test_chunkcoding(self):
43
support.run_unittest(__name__)
45
if __name__ == "__main__":