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