| 1 |
|
| 2 |
|
| 3 |
from test import test_support |
| 4 |
from test import multibytecodec_support |
| 5 |
import unittest |
| 6 |
|
| 7 |
COMMON_CODEC_TESTS = ( |
| 8 |
|
| 9 |
(b'ab\xFFcd', 'replace', u'ab\uFFFDcd'), |
| 10 |
(b'ab\x1Bdef', 'replace', u'ab\x1Bdef'), |
| 11 |
(b'ab\x1B$def', 'replace', u'ab\uFFFD'), |
| 12 |
) |
| 13 |
|
| 14 |
class Test_ISO2022_JP(multibytecodec_support.TestBase, unittest.TestCase): |
| 15 |
encoding = 'iso2022_jp' |
| 16 |
tstring = multibytecodec_support.load_teststring('iso2022_jp') |
| 17 |
codectests = COMMON_CODEC_TESTS + ( |
| 18 |
(b'ab\x1BNdef', 'replace', u'ab\x1BNdef'), |
| 19 |
) |
| 20 |
|
| 21 |
class Test_ISO2022_JP2(multibytecodec_support.TestBase, unittest.TestCase): |
| 22 |
encoding = 'iso2022_jp_2' |
| 23 |
tstring = multibytecodec_support.load_teststring('iso2022_jp') |
| 24 |
codectests = COMMON_CODEC_TESTS + ( |
| 25 |
(b'ab\x1BNdef', 'replace', u'abdef'), |
| 26 |
) |
| 27 |
|
| 28 |
class Test_ISO2022_KR(multibytecodec_support.TestBase, unittest.TestCase): |
| 29 |
encoding = 'iso2022_kr' |
| 30 |
tstring = multibytecodec_support.load_teststring('iso2022_kr') |
| 31 |
codectests = COMMON_CODEC_TESTS + ( |
| 32 |
(b'ab\x1BNdef', 'replace', u'ab\x1BNdef'), |
| 33 |
) |
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
@unittest.skip('iso2022_kr.txt cannot be used to test "chunk coding"') |
| 38 |
def test_chunkcoding(self): |
| 39 |
pass |
| 40 |
|
| 41 |
def test_main(): |
| 42 |
test_support.run_unittest(__name__) |
| 43 |
|
| 44 |
if __name__ == "__main__": |
| 45 |
test_main() |