MCPcopy Create free account
hub / github.com/PyCQA/flake8 / test_tokenization_error_is_a_syntax_error

Function test_tokenization_error_is_a_syntax_error

tests/integration/test_main.py:181–194  ·  view source on GitHub ↗

Test when tokenize raises a SyntaxError.

(tmpdir, capsys)

Source from the content-addressed store, hash-verified

179
180
181def test_tokenization_error_is_a_syntax_error(tmpdir, capsys):
182 """Test when tokenize raises a SyntaxError."""
183 with tmpdir.as_cwd():
184 tmpdir.join("t.py").write("if True:\n pass\n pass\n")
185 assert cli.main(["t.py"]) == 1
186
187 if sys.implementation.name == "pypy": # pragma: no cover (pypy)
188 expected = "t.py:3:3: E999 IndentationError: unindent does not match any outer indentation level\n" # noqa: E501
189 else: # pragma: no cover (cp310+)
190 expected = "t.py:3:7: E999 IndentationError: unindent does not match any outer indentation level\n" # noqa: E501
191
192 out, err = capsys.readouterr()
193 assert out == expected
194 assert err == ""
195
196
197def test_bug_report_successful(capsys):

Callers

nothing calls this directly

Calls 1

writeMethod · 0.80

Tested by

no test coverage detected