Skip to content

Commit 0eff305

Browse files
vriesDimitriPapadopoulos
authored andcommitted
Add two tests in test_stdin to increase coverage
Coverage increases: - parse_lines: 92% -> 94% - parse_file : 79% -> 87%
1 parent 075d076 commit 0eff305

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

codespell_lib/tests/test_basic.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1429,7 +1429,7 @@ def run_codespell_stdin(
14291429
return output.count("\n")
14301430

14311431

1432-
def test_stdin(tmp_path: Path) -> None:
1432+
def test_stdin(tmp_path: Path, capsys: pytest.CaptureFixture[str]) -> None:
14331433
"""Test running the codespell executable."""
14341434
input_file_lines = 4
14351435
text = ""
@@ -1444,3 +1444,17 @@ def test_stdin(tmp_path: Path) -> None:
14441444
assert run_codespell_stdin(
14451445
text, args=args, cwd=tmp_path
14461446
) == input_file_lines * (2 - int(single_line_per_error))
1447+
1448+
with FakeStdin("Thsi is a line"):
1449+
result = cs.main("-", "-w", std=True)
1450+
assert isinstance(result, tuple)
1451+
code, stdout, _ = result
1452+
assert stdout == "---\nThis is a line"
1453+
assert code == 0
1454+
1455+
with FakeStdin("Thsi is a line"):
1456+
result = cs.main("-", "--stdin-single-line", std=True)
1457+
assert isinstance(result, tuple)
1458+
code, stdout, _ = result
1459+
assert stdout == "1: Thsi ==> This\n"
1460+
assert code == 1

0 commit comments

Comments
 (0)