(self)
| 212 | |
| 213 | @support.cpython_only |
| 214 | def test_subinterp(self): |
| 215 | # bpo-42846: Test a CJK codec in a subinterpreter |
| 216 | _testcapi = import_module("_testcapi") |
| 217 | encoding = 'cp932' |
| 218 | text = "Python の開発は、1990 年ごろから開始されています。" |
| 219 | code = textwrap.dedent(""" |
| 220 | import codecs |
| 221 | encoding = %r |
| 222 | text = %r |
| 223 | encoder = codecs.getincrementalencoder(encoding)() |
| 224 | text2 = encoder.encode(text).decode(encoding) |
| 225 | if text2 != text: |
| 226 | raise ValueError(f"encoding issue: {text2!a} != {text!a}") |
| 227 | """) % (encoding, text) |
| 228 | res = _testcapi.run_in_subinterp(code) |
| 229 | self.assertEqual(res, 0) |
| 230 | |
| 231 | class Test_IncrementalDecoder(unittest.TestCase): |
| 232 |
nothing calls this directly
no test coverage detected