def test_ignore_file_keep_dir(self): f = makeDirFilter([ 'a/foo.txt' ]) assert f('a/') assert f('./a') assert f('b/a/')
def test_dir_at_any_depth(self): f = makeDirFilter([ 'a/' ]) assert f('a/') assert f('./a') assert f('b/a/')
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')
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/')
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/')
def get_dir_filter(groups): return makeDirFilter(sorted(set(chain( *(d['rules'] for d in groups.values()) ))))
def get_dir_filter(groups): return makeDirFilter( sorted(set(chain(*(d['rules'] for d in groups.values())))))
def test_empty_rules(self): f = makeDirFilter([]) assert f('') is False assert f('a/') is False