def test_print_data_count(tmp_path, monkeypatch, capsys): monkeypatch.chdir(tmp_path) grep.print_data('24', 'no_name', False, False) out, err = capsys.readouterr() assert err == '' assert out == '24\n'
def test_print_data_various_files(tmp_path, monkeypatch, capsys): monkeypatch.chdir(tmp_path) grep.print_data('just like my life)))', 'a.txt', True, False) out, err = capsys.readouterr() assert err == '' assert out == 'a.txt:just like my life)))\n'
def test_print_data_one_file(tmp_path, monkeypatch, capsys): monkeypatch.chdir(tmp_path) grep.print_data('pref needle suf', 'no_name', False, False) out, err = capsys.readouterr() assert err == '' assert out == 'pref needle suf\n'
def test_print_data_no_files(tmp_path, monkeypatch, capsys): monkeypatch.chdir(tmp_path) grep.print_data('I think this test is useless', 'no_name', False, False) out, err = capsys.readouterr() assert err == '' assert out == 'I think this test is useless\n'
def test_print_data_various_files_count(tmp_path, monkeypatch, capsys): monkeypatch.chdir(tmp_path) grep.print_data('24', 'a.txt', True, False) out, err = capsys.readouterr() assert err == '' assert out == 'a.txt:24\n'