Пример #1
0
def test_empty_string(capsys):
    my_precious_logger("")
    captured = capsys.readouterr()
    assert not captured.out
    assert not captured.err
Пример #2
0
def test_stderr(capsys):
    text = "error: file nor found"
    my_precious_logger(text)
    captured = capsys.readouterr()
    assert captured.err == text
    assert not captured.out
Пример #3
0
def test_stdout(capsys):
    text = "OK"
    my_precious_logger(text)
    captured = capsys.readouterr()
    assert captured.out == text
    assert not captured.err
Пример #4
0
def test_startswith_error_text_write_to_stderr(capsys):
    text = "error message"
    my_precious_logger(text)
    _out, err = capsys.readouterr()
    assert err == text
Пример #5
0
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
Пример #6
0
def test_my_precious_logger_out(capsys):
    hw3.my_precious_logger("hello")
    captured = capsys.readouterr()
    assert captured.out == "hello\n"
    assert captured.err == ""
Пример #7
0
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 == ""