def test_dot_dot():
    fr = FileRecognizer(skip_hidden_files=True, skip_hidden_dirs=True,
        skip_exts=set(['.skip_ext']),skip_dirs=set(['skip_dir']))
    truth = [
        ('../binary', 'binary'),
        ('../dir.skip_ext/text', 'text'),
        ('../dir/subdir/text', 'text'),
        ('../dir/text', 'text'),
        ('../text', 'text'),
        ('../text.dont_skip_ext', 'text'),
    ]
    result = sorted(fr.walk('..'))
    assert result == truth
Example #2
0
def test_dot_dot():
    fr = FileRecognizer(skip_hidden_files=True, skip_hidden_dirs=True,
        skip_exts=set(['.skip_ext']),skip_dirs=set(['skip_dir']))
    truth = [
        ('../binary', 'binary'),
        ('../dir.skip_ext/text', 'text'),
        ('../dir/subdir/text', 'text'),
        ('../dir/text', 'text'),
        ('../text', 'text'),
        ('../text.dont_skip_ext', 'text'),
    ]
    result = sorted(fr.walk('..'))
    assert result == truth
Example #3
0
def test_dot_dot():
    fr = FileRecognizer(skip_hidden_files=True, skip_hidden_dirs=True,
                        skip_exts=set(['.skip_ext']),
                        skip_dirs=set(['skip_dir']))
    truth = [
        (os.path.join(os.curdir, 'binary'), 'binary'),
        (os.path.join(os.curdir, 'dir.skip_ext', 'text'), 'text'),
        (os.path.join(os.curdir, 'dir', 'subdir', 'text'), 'text'),
        (os.path.join(os.curdir, 'dir', 'text'), 'text'),
        (os.path.join(os.curdir, 'text'), 'text'),
        (os.path.join(os.curdir, 'text.dont_skip_ext'), 'text'),
    ]
    result = sorted(fr.walk(os.pardir))
    nt.assert_equal(result, truth)
Example #4
0
def test_walking():
    fr = FileRecognizer(skip_hidden_files=True, skip_hidden_dirs=True,
                        skip_exts=set(['.skip_ext']),
                        skip_dirs=set(['skip_dir']))
    truth = [
        ('tree/binary', 'binary'),
        ('tree/dir.skip_ext/text', 'text'),
        ('tree/dir/subdir/text', 'text'),
        ('tree/dir/text', 'text'),
        ('tree/text', 'text'),
        ('tree/text.dont_skip_ext', 'text'),
    ]
    result = sorted(fr.walk('tree'))
    nt.assert_equal(result, truth)
Example #5
0
def test_dot_dot():
    fr = FileRecognizer(skip_hidden_files=True,
                        skip_hidden_dirs=True,
                        skip_exts=set(['.skip_ext']),
                        skip_dirs=set(['skip_dir']))
    truth = [
        (os.path.join(os.curdir, 'binary'), 'binary'),
        (os.path.join(os.curdir, 'dir.skip_ext', 'text'), 'text'),
        (os.path.join(os.curdir, 'dir', 'subdir', 'text'), 'text'),
        (os.path.join(os.curdir, 'dir', 'text'), 'text'),
        (os.path.join(os.curdir, 'text'), 'text'),
        (os.path.join(os.curdir, 'text.dont_skip_ext'), 'text'),
    ]
    result = sorted(fr.walk(os.pardir))
    nt.assert_equal(result, truth)
Example #6
0
def test_walking():
    fr = FileRecognizer(skip_hidden_files=True,
                        skip_hidden_dirs=True,
                        skip_exts=set(['.skip_ext']),
                        skip_dirs=set(['skip_dir']))
    truth = [
        ('tree/binary', 'binary'),
        ('tree/dir.skip_ext/text', 'text'),
        ('tree/dir/subdir/text', 'text'),
        ('tree/dir/text', 'text'),
        ('tree/text', 'text'),
        ('tree/text.dont_skip_ext', 'text'),
    ]
    result = sorted(fr.walk('tree'))
    nt.assert_equal(result, truth)
Example #7
0
 def test_walking(self):
     fr = FileRecognizer(
         skip_hidden_files=True,
         skip_hidden_dirs=True,
         skip_exts=set([".skip_ext"]),
         skip_dirs=set(["skip_dir"]),
     )
     truth = [
         ("tree/binary", "binary"),
         ("tree/dir.skip_ext/text", "text"),
         ("tree/dir/subdir/text", "text"),
         ("tree/dir/text", "text"),
         ("tree/text", "text"),
         ("tree/text.dont_skip_ext", "text"),
     ]
     result = sorted(fr.walk("tree"))
     self.assertEqual(result, truth)
Example #8
0
def test_dot_dot():
    fr = FileRecognizer(
        skip_hidden_files=True,
        skip_hidden_dirs=True,
        skip_exts=set([b".skip_ext"]),
        skip_dirs=set([b"skip_dir"]),
    )
    truth = [
        (b"../binary", "binary"),
        (b"../dir.skip_ext/text", "text"),
        (b"../dir/subdir/text", "text"),
        (b"../dir/text", "text"),
        (b"../text", "text"),
        (b"../text.dont_skip_ext", "text"),
    ]
    result = sorted(fr.walk(b".."))
    assert result == truth