Skip to content

Commit

Permalink
[ADD] add missing branch print test
Browse files Browse the repository at this point in the history
  • Loading branch information
guigui0246 committed Oct 15, 2023
1 parent 8b0ca76 commit 5b5516a
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test_print.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ def test_clear_cache():
PRINT_BUFFER["./somefile"] = "Text"
clear_cache("./somefile")
assert PRINT_BUFFER == {}
clear_cache("./somefile")
assert PRINT_BUFFER == {}
PRINT_BUFFER["./somefile"] = "Text"
PRINT_BUFFER["./someotherfile"] = "Tet"
clear_cache(all=True)
Expand Down Expand Up @@ -154,6 +156,14 @@ def test_clear_error(capfd):
clear(sys.stdin)
txt = capfd.readouterr()[1]
assert "File could not be written for clear! Using stdout." in txt
with pytest.raises(KeyError):
PRINT_BUFFER[sys.stdin]
PRINT_BUFFER[sys.stdin] = "this\n"
clear(sys.stdin, True)
txt = capfd.readouterr()[1]
assert not "File could not be written for clear! Using stdout." in txt
with pytest.raises(KeyError):
PRINT_BUFFER[sys.stdin]
clear_cache(all=True)

@pytest.mark.usefixtures("capfd")
Expand Down

0 comments on commit 5b5516a

Please sign in to comment.