MCPcopy Index your code
hub / github.com/python/cpython / test_subinterp

Method test_subinterp

Lib/test/test_multibytecodec.py:214–229  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

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
231class Test_IncrementalDecoder(unittest.TestCase):
232

Callers

nothing calls this directly

Calls 3

import_moduleFunction · 0.90
dedentMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected