From 2e68d907022c84392597e05afc22d9fe06bf0927 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Wed, 21 Oct 2009 18:45:41 +0200 Subject: tree.traverse: Added prune functionality - previously the predciate did both, pruning and preventing to return items --- test/git/test_tree.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'test/git/test_tree.py') 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 ) -- cgit v1.2.1