Example #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"))
Example #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"]))
Example #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"
Example #4
0
def test_find_right_extension(path):
    matches = search.find_dir(path, ["gif"], ["che", "py"])
    assert len(matches) == 0
Example #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"
Example #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"
Example #7
0
def test_find_two_files(path):
    matches = search.find_dir(path, ["txt"], ["cheats"])
    assert len(matches) == 2