def test_empty_string(capsys): my_precious_logger("") captured = capsys.readouterr() assert not captured.out assert not captured.err
def test_stderr(capsys): text = "error: file nor found" my_precious_logger(text) captured = capsys.readouterr() assert captured.err == text assert not captured.out
def test_stdout(capsys): text = "OK" my_precious_logger(text) captured = capsys.readouterr() assert captured.out == text assert not captured.err
def test_startswith_error_text_write_to_stderr(capsys): text = "error message" my_precious_logger(text) _out, err = capsys.readouterr() assert err == text
def test_text_without_error_write_to_stdout(capsys): text = "some message withot errors" my_precious_logger(text) out, _err = capsys.readouterr() assert out == text
def test_my_precious_logger_out(capsys): hw3.my_precious_logger("hello") captured = capsys.readouterr() assert captured.out == "hello\n" assert captured.err == ""
def test_my_precious_logger_err(capsys): hw3.my_precious_logger("error: file not found") captured = capsys.readouterr() assert captured.err == "error: file not found\n" assert captured.out == ""