Example #1
0
    def test_ignore_file_keep_dir(self):
        f = makeDirFilter([
            'a/foo.txt'
        ])

        assert f('a/')
        assert f('./a')
        assert f('b/a/')
Example #2
0
    def test_dir_at_any_depth(self):
        f = makeDirFilter([
            'a/'
        ])

        assert f('a/')
        assert f('./a')
        assert f('b/a/')
Example #3
0
    def test_double_asterisk_in_a_path_starting_with_dot(self):
        f = makeDirFilter([
            './a/**/c/'
        ])

        assert f('./a/b/c')
        assert f('./a/b1/b2/c')
        assert f('./a/b/d') is False
        assert f('a/b/c')
Example #4
0
    def test_working_directory_dot_slash(self):
        f = makeDirFilter([
            '././'
        ])

        assert f('.')
        assert f('./')
        assert f('foo.txt')
        assert f('./foo.txt')
        assert f('a/b/')
Example #5
0
    def test_excluded_dir(self):
        f = makeDirFilter([
            'a/',
            '!a/b/',
            '!a/c/foo.txt',
            '!a/d/',
            '+a/d/baz.txt'
        ])

        assert f('a/')
        assert f('a/b/') is False
        assert f('a/c/')
        assert f('a/d/')
Example #6
0
def get_dir_filter(groups):
    return makeDirFilter(sorted(set(chain(
        *(d['rules'] for d in groups.values())
    ))))
Example #7
0
def get_dir_filter(groups):
    return makeDirFilter(
        sorted(set(chain(*(d['rules'] for d in groups.values())))))
Example #8
0
    def test_empty_rules(self):
        f = makeDirFilter([])

        assert f('') is False
        assert f('a/') is False