MCPcopy
hub / github.com/psf/black / test_for_handled_unexpected_eof_error

Method test_for_handled_unexpected_eof_error

tests/test_black.py:1979–1993  ·  view source on GitHub ↗

Test that an unexpected EOF SyntaxError is nicely presented.

(self)

Source from the content-addressed store, hash-verified

1977 ), "Incorrect config loaded."
1978
1979 def test_for_handled_unexpected_eof_error(self) -> None:
1980 """
1981 Test that an unexpected EOF SyntaxError is nicely presented.
1982 """
1983 with pytest.raises(black.parsing.InvalidInput) as exc_info:
1984 black.lib2to3_parse("print(", {})
1985
1986 exc_info.match(
1987 re.escape(
1988 "Cannot parse: 1:6\n"
1989 " print(\n"
1990 " ^\n"
1991 "TokenError: Unexpected EOF in multi-line statement"
1992 )
1993 )
1994
1995 def test_line_ranges_with_code_option(self) -> None:
1996 code = textwrap.dedent("""\

Callers

nothing calls this directly

Calls 1

matchMethod · 0.45

Tested by

no test coverage detected