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

Method test_EOFS_with_file

Lib/test/test_eof.py:51–88  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

49 @unittest.expectedFailure # TODO: RUSTPYTHON
50 @force_not_colorized
51 def test_EOFS_with_file(self):
52 expect = ("(<string>, line 1)")
53 with os_helper.temp_dir() as temp_dir:
54 file_name = script_helper.make_script(temp_dir, 'foo',
55 """ä = '''thîs is \na \ntest""")
56 rc, out, err = script_helper.assert_python_failure('-X', 'utf8', file_name)
57 err = err.decode().splitlines()
58 self.assertEqual(err[-3:], [
59 " ä = '''thîs is ",
60 ' ^',
61 'SyntaxError: unterminated triple-quoted string literal (detected at line 3)'])
62
63 file_name = script_helper.make_script(temp_dir, 'foo',
64 """ä = '''thîs is \na \ntest""".encode())
65 rc, out, err = script_helper.assert_python_failure('-X', 'utf8', file_name)
66 err = err.decode().splitlines()
67 self.assertEqual(err[-3:], [
68 " ä = '''thîs is ",
69 ' ^',
70 'SyntaxError: unterminated triple-quoted string literal (detected at line 3)'])
71
72 file_name = script_helper.make_script(temp_dir, 'foo',
73 BOM_UTF8 + """ä = '''thîs is \na \ntest""".encode())
74 rc, out, err = script_helper.assert_python_failure('-X', 'utf8', file_name)
75 err = err.decode().splitlines()
76 self.assertEqual(err[-3:], [
77 " ä = '''thîs is ",
78 ' ^',
79 'SyntaxError: unterminated triple-quoted string literal (detected at line 3)'])
80
81 file_name = script_helper.make_script(temp_dir, 'foo',
82 """# coding: latin1\nä = '''thîs is \na \ntest""".encode('latin1'))
83 rc, out, err = script_helper.assert_python_failure('-X', 'utf8', file_name)
84 err = err.decode().splitlines()
85 self.assertEqual(err[-3:], [
86 " ä = '''thîs is ",
87 ' ^',
88 'SyntaxError: unterminated triple-quoted string literal (detected at line 4)'])
89
90 @unittest.expectedFailure # TODO: RUSTPYTHON
91 @warnings_helper.ignore_warnings(category=SyntaxWarning)

Callers

nothing calls this directly

Calls 5

make_scriptMethod · 0.45
splitlinesMethod · 0.45
decodeMethod · 0.45
assertEqualMethod · 0.45
encodeMethod · 0.45

Tested by

no test coverage detected