X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/17e42cb94b494f0e5d7c80ee842f578a5a3cefcc..085efac037c07ef299edbf48a4d871f17b296743:/tests/test_black.py?ds=sidebyside diff --git a/tests/test_black.py b/tests/test_black.py index 4267c61..9259853 100644 --- a/tests/test_black.py +++ b/tests/test_black.py @@ -1557,6 +1557,15 @@ class BlackTestCase(BlackBaseTestCase): call_args[0].lower() == str(pyproject_path).lower() ), "Incorrect config loaded." + def test_for_handled_unexpected_eof_error(self) -> None: + """ + Test that an unexpected EOF SyntaxError is nicely presented. + """ + with pytest.raises(black.parsing.InvalidInput) as exc_info: + black.lib2to3_parse("print(", {}) + + exc_info.match("Cannot parse: 2:0: EOF in multi-line statement") + class TestCaching: def test_cache_broken_file(self) -> None: @@ -1755,7 +1764,7 @@ def assert_collected_sources( report=black.Report(), stdin_filename=stdin_filename, ) - assert sorted(list(collected)) == sorted(gs_expected) + assert sorted(collected) == sorted(gs_expected) class TestFileCollection: