Skip to content

Commit

Permalink
fixup tests
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoGorelli committed Aug 5, 2024
1 parent 8bfda21 commit 0f946fa
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions tests/tools/test_pylint_works.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def test_pylint_works(capsys: "CaptureFixture") -> None:
f'{notebook1}:cell_4:1:0: C0413: Import "from random import randint" should be placed at the top of the module (wrong-import-position)\n' # noqa: E501
f'{notebook1}:cell_5:1:0: C0413: Import "import pprint" should be placed at the top of the module (wrong-import-position)\n' # noqa: E501
f'{notebook1}:cell_5:2:0: C0413: Import "import sys" should be placed at the top of the module (wrong-import-position)\n' # noqa: E501
f"{notebook1}:cell_5:9:0: E0606: Possibly using variable 'pretty_print_object' before assignment (possibly-used-before-assignment)\n" # noqa: E501
f'{notebook1}:cell_4:1:0: C0411: standard import "random.randint" should be placed before first party import "nbqa" (wrong-import-order)\n' # noqa: E501
f'{notebook1}:cell_5:1:0: C0411: standard import "pprint" should be placed before first party import "nbqa" (wrong-import-order)\n' # noqa: E501
f'{notebook1}:cell_5:2:0: C0411: standard import "sys" should be placed before first party import "nbqa" (wrong-import-order)\n' # noqa: E501
Expand Down
12 changes: 6 additions & 6 deletions tests/tools/test_ruff_works.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,22 +53,22 @@ def test_ruff_works(
expected_path_2 = os.path.join("tests", "data", "notebook_starting_with_md.ipynb")

out, err = capsys.readouterr()
# ignore ruff's suggestions
out = "\n".join([x for x in out.splitlines() if "cell_" in x])
expected_out = (
"Found 13 errors.\n"
"[*] 10 fixable with the `--fix` option.\n"
f"{expected_path_1}:cell_1:1:8: F401 [*] `os` imported but unused\n"
f"{expected_path_1}:cell_1:3:8: F401 [*] `glob` imported but unused\n"
f"{expected_path_1}:cell_1:5:8: F401 [*] `nbqa` imported but unused\n"
f"{expected_path_0}:cell_1:1:8: F401 [*] `os` imported but unused\n"
f"{expected_path_0}:cell_1:3:8: F401 [*] `glob` imported but unused\n"
f"{expected_path_0}:cell_1:5:8: F401 [*] `nbqa` imported but unused\n"
f"{expected_path_0}:cell_4:1:1: E402 Module level import not at top of file\n"
f"{expected_path_0}:cell_4:1:20: F401 [*] `random.randint` imported but unused\n"
f"{expected_path_0}:cell_5:1:1: E402 Module level import not at top of file\n"
f"{expected_path_0}:cell_5:2:1: E402 Module level import not at top of file\n"
f"{expected_path_1}:cell_1:1:8: F401 [*] `os` imported but unused\n"
f"{expected_path_1}:cell_1:3:8: F401 [*] `glob` imported but unused\n"
f"{expected_path_1}:cell_1:5:8: F401 [*] `nbqa` imported but unused\n"
f"{expected_path_2}:cell_1:1:8: F401 [*] `os` imported but unused\n"
f"{expected_path_2}:cell_1:3:8: F401 [*] `glob` imported but unused\n"
f"{expected_path_2}:cell_1:5:8: F401 [*] `nbqa` imported but unused"
f"{expected_path_2}:cell_1:5:8: F401 [*] `nbqa` imported but unused\n"
)
assert "\n".join(sorted(out.replace("\r\n", "\n").splitlines())) == "\n".join(
sorted(expected_out.splitlines())
Expand Down

0 comments on commit 0f946fa

Please sign in to comment.