diff options
author | Sebastian Thiel <byronimo@gmail.com> | 2009-10-21 18:45:41 +0200 |
---|---|---|
committer | Sebastian Thiel <byronimo@gmail.com> | 2009-10-21 20:14:52 +0200 |
commit | 2e68d907022c84392597e05afc22d9fe06bf0927 (patch) | |
tree | 57288a5bddc55baff4bae0e7b9ed67276ac8bc55 /test/git/test_tree.py | |
parent | d97afa24ad1ae453002357e5023f3a116f76fb17 (diff) | |
download | gitpython-2e68d907022c84392597e05afc22d9fe06bf0927.tar.gz |
tree.traverse: Added prune functionality - previously the predciate did both, pruning and preventing to return items
Diffstat (limited to 'test/git/test_tree.py')
-rw-r--r-- | test/git/test_tree.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/test/git/test_tree.py b/test/git/test_tree.py index dafb6f3f..b359e2d2 100644 --- a/test/git/test_tree.py +++ b/test/git/test_tree.py @@ -35,6 +35,11 @@ class TestTree(TestCase): trees = list(root.traverse(predicate = trees_only)) assert len(trees) == len(list( i for i in root.traverse() if trees_only(i) )) + # test prune + lib_folder = lambda t: t.path == "lib" + pruned_trees = list(root.traverse(predicate = trees_only,prune = lib_folder)) + assert len(pruned_trees) < len(trees) + # trees and blobs assert len(set(trees)|set(root.trees)) == len(trees) assert len(set(b for b in root if isinstance(b, Blob)) | set(root.blobs)) == len( root.blobs ) |