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