Exemplo n.º 1
0
def test_find_wrong_command(path):
    with pytest.raises(search.SearchError):
        search.grep_dir(
            search.find_dir(path, ["txt"], ["python"],
                            find_cmd="no_such_find_cmdn"))
Exemplo n.º 2
0
def test_find_wrong_path(path):
    with pytest.raises(search.SearchError):
        search.grep_dir(
            search.find_dir(os.path.join(path, "nosuchdir"), ["txt"],
                            ["python"]))
Exemplo n.º 3
0
def test_find_one_file(path):
    matches = search.find_dir(path, ["txt"], ["python"])
    assert len(matches) == 1
    assert matches[0] == "python cheatsheet.txt"
Exemplo n.º 4
0
def test_find_right_extension(path):
    matches = search.find_dir(path, ["gif"], ["che", "py"])
    assert len(matches) == 0
Exemplo n.º 5
0
def test_find_pattern_with_two_parts_swapped(path):
    matches = search.find_dir(path, ["txt"], ["che", "py"])
    assert len(matches) == 1
    assert matches[0] == "python cheatsheet.txt"
Exemplo n.º 6
0
def test_find_case_insensitive(path):
    matches = search.find_dir(path, ["txt"], ["py"])
    assert len(matches) == 1
    assert matches[0] == "PYTHON cheatsheet.txt"
Exemplo n.º 7
0
def test_find_two_files(path):
    matches = search.find_dir(path, ["txt"], ["cheats"])
    assert len(matches) == 2