MCPcopy Index your code
hub / github.com/bpython/bpython / test_syntaxerror

Method test_syntaxerror

bpython/test/test_interpreter.py:19–87  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

17
18class TestInterpreter(unittest.TestCase):
19 def test_syntaxerror(self):
20 i = Interpreter()
21
22 i.runsource("1.1.1.1")
23
24 if (3, 10, 1) <= sys.version_info[:3]:
25 expected = (
26 " File "
27 + green('"<input>"')
28 + ", line "
29 + bold(magenta("1"))
30 + "\n 1.1.1.1\n ^^\n"
31 + bold(red("SyntaxError"))
32 + ": "
33 + cyan("invalid syntax")
34 + "\n"
35 )
36 elif (3, 10) <= sys.version_info[:2]:
37 expected = (
38 " File "
39 + green('"<input>"')
40 + ", line "
41 + bold(magenta("1"))
42 + "\n 1.1.1.1\n ^^^^^\n"
43 + bold(red("SyntaxError"))
44 + ": "
45 + cyan("invalid syntax. Perhaps you forgot a comma?")
46 + "\n"
47 )
48 elif (3, 8) <= sys.version_info[:2]:
49 expected = (
50 " File "
51 + green('"<input>"')
52 + ", line "
53 + bold(magenta("1"))
54 + "\n 1.1.1.1\n ^\n"
55 + bold(red("SyntaxError"))
56 + ": "
57 + cyan("invalid syntax")
58 + "\n"
59 )
60 elif pypy:
61 expected = (
62 " File "
63 + green('"<input>"')
64 + ", line "
65 + bold(magenta("1"))
66 + "\n 1.1.1.1\n ^\n"
67 + bold(red("SyntaxError"))
68 + ": "
69 + cyan("invalid syntax")
70 + "\n"
71 )
72 else:
73 expected = (
74 " File "
75 + green('"<input>"')
76 + ", line "

Callers

nothing calls this directly

Calls 2

runsourceMethod · 0.95
InterpreterClass · 0.70

Tested by

no test coverage detected