| OLD | NEW |
| 1 # Tests invocation of the interpreter with various command line arguments | 1 # Tests invocation of the interpreter with various command line arguments |
| 2 # Most tests are executed with environment variables ignored | 2 # Most tests are executed with environment variables ignored |
| 3 # See test_cmd_line_script.py for testing of script execution | 3 # See test_cmd_line_script.py for testing of script execution |
| 4 | 4 |
| 5 import test.support, unittest | 5 import test.support, unittest |
| 6 import os | 6 import os |
| 7 import sys | 7 import sys |
| 8 import subprocess | 8 import subprocess |
| 9 import tempfile | 9 import tempfile |
| 10 from test.script_helper import spawn_python, kill_python, assert_python_ok, asse
rt_python_failure | 10 from test.script_helper import spawn_python, kill_python, assert_python_ok, asse
rt_python_failure |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 # on Windows (sys.stdin is opened in binary mode) | 251 # on Windows (sys.stdin is opened in binary mode) |
| 252 self.check_input( | 252 self.check_input( |
| 253 "import sys; print(repr(sys.stdin.readline()))", | 253 "import sys; print(repr(sys.stdin.readline()))", |
| 254 b"'abc\\n'") | 254 b"'abc\\n'") |
| 255 | 255 |
| 256 def test_builtin_input(self): | 256 def test_builtin_input(self): |
| 257 # Issue #11272: check that input() strips newlines ('\n' or '\r\n') | 257 # Issue #11272: check that input() strips newlines ('\n' or '\r\n') |
| 258 self.check_input( | 258 self.check_input( |
| 259 "print(repr(input()))", | 259 "print(repr(input()))", |
| 260 b"'abc'") | 260 b"'abc'") |
| 261 |
| 262 def test_unmached_quote(self): |
| 263 # Issue #10206: python program starting with unmatched quote |
| 264 # spews spaces to stdout |
| 265 rc, out, err = assert_python_failure('-c', "'") |
| 266 self.assertRegex(err.decode('ascii', 'ignore'), 'SyntaxError') |
| 267 self.assertEqual(b'', out) |
| 261 | 268 |
| 262 | 269 |
| 263 def test_main(): | 270 def test_main(): |
| 264 test.support.run_unittest(CmdLineTest) | 271 test.support.run_unittest(CmdLineTest) |
| 265 test.support.reap_children() | 272 test.support.reap_children() |
| 266 | 273 |
| 267 if __name__ == "__main__": | 274 if __name__ == "__main__": |
| 268 test_main() | 275 test_main() |
| OLD | NEW |