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

Method check_encoding

Lib/test/test_string_literals.py:322–332  ·  view source on GitHub ↗
(self, encoding, extra="")

Source from the content-addressed store, hash-verified

320 self.assertEqual(eval(r""" U'\U0001d120' """), u'\U0001d120')
321
322 def check_encoding(self, encoding, extra=""):
323 modname = "xx_" + encoding.replace("-", "_")
324 fn = os.path.join(self.tmpdir, modname + ".py")
325 f = open(fn, "w", encoding=encoding)
326 try:
327 f.write(TEMPLATE % encoding)
328 f.write(extra)
329 finally:
330 f.close()
331 __import__(modname)
332 del sys.modules[modname]
333
334 def test_file_utf_8(self):
335 extra = "z = '\u1234'; assert ord(z) == 0x1234\n"

Callers 5

test_file_utf_8Method · 0.95
test_file_utf8Method · 0.95
test_file_iso_8859_1Method · 0.95
test_file_latin_1Method · 0.95
test_file_latin9Method · 0.95

Calls 6

__import__Function · 0.85
openFunction · 0.50
replaceMethod · 0.45
joinMethod · 0.45
writeMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected