MCPcopy Create free account
hub / github.com/ipython/ipython / syntax_error_transformer

Function syntax_error_transformer

IPython/terminal/tests/test_interactivshell.py:169–178  ·  view source on GitHub ↗

Transformer that throws SyntaxError if 'syntaxerror' is in the code.

(lines)

Source from the content-addressed store, hash-verified

167 assert captured.stdout == ''
168
169def syntax_error_transformer(lines):
170 """Transformer that throws SyntaxError if 'syntaxerror' is in the code."""
171 for line in lines:
172 pos = line.find('syntaxerror')
173 if pos >= 0:
174 e = SyntaxError('input contains "syntaxerror"')
175 e.text = line
176 e.offset = pos + 1
177 raise e
178 return lines
179
180
181class TerminalMagicsTestCase(unittest.TestCase):

Callers

nothing calls this directly

Calls 1

findMethod · 0.45

Tested by

no test coverage detected