MCPcopy Index your code
hub / github.com/RustPython/RustPython / check_encoding

Method check_encoding

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

Source from the content-addressed store, hash-verified

324 self.assertEqual(eval(r""" U'\U0001d120' """), u'\U0001d120')
325
326 def check_encoding(self, encoding, extra=""):
327 modname = "xx_" + encoding.replace("-", "_")
328 fn = os.path.join(self.tmpdir, modname + ".py")
329 f = open(fn, "w", encoding=encoding)
330 try:
331 f.write(TEMPLATE % encoding)
332 f.write(extra)
333 finally:
334 f.close()
335 __import__(modname)
336 del sys.modules[modname]
337
338 def test_file_utf_8(self):
339 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

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

Tested by

no test coverage detected