summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/git/test_base.py16
-rw-r--r--test/git/test_index.py11
-rw-r--r--test/git/test_tree.py2
3 files changed, 19 insertions, 10 deletions
diff --git a/test/git/test_base.py b/test/git/test_base.py
index 497f90fb..ab46ded4 100644
--- a/test/git/test_base.py
+++ b/test/git/test_base.py
@@ -16,10 +16,10 @@ import tempfile
class TestBase(TestBase):
- type_tuples = ( ("blob", "8741fc1d09d61f02ffd8cded15ff603eff1ec070"),
- ("tree", "3a6a5e3eeed3723c09f1ef0399f81ed6b8d82e79"),
- ("commit", "4251bd59fb8e11e40c40548cba38180a9536118c"),
- ("tag", "e56a60e8e9cd333cfba0140a77cd12b0d9398f10") )
+ type_tuples = ( ("blob", "8741fc1d09d61f02ffd8cded15ff603eff1ec070", "blob.py"),
+ ("tree", "3a6a5e3eeed3723c09f1ef0399f81ed6b8d82e79", "directory"),
+ ("commit", "4251bd59fb8e11e40c40548cba38180a9536118c", None),
+ ("tag", "e56a60e8e9cd333cfba0140a77cd12b0d9398f10", None) )
def test_base_object(self):
# test interface of base object classes
@@ -29,8 +29,12 @@ class TestBase(TestBase):
s = set()
num_objs = 0
num_index_objs = 0
- for obj_type, (typename, hexsha) in zip(types, self.type_tuples):
- item = obj_type(self.rorepo,hexsha)
+ for obj_type, (typename, hexsha, path) in zip(types, self.type_tuples):
+ item = None
+ if path is None:
+ item = obj_type(self.rorepo,hexsha)
+ else:
+ item = obj_type(self.rorepo,hexsha, 0, path)
num_objs += 1
assert item.sha == hexsha
assert item.type == typename
diff --git a/test/git/test_index.py b/test/git/test_index.py
index e6e23ba7..2f4da161 100644
--- a/test/git/test_index.py
+++ b/test/git/test_index.py
@@ -83,11 +83,16 @@ class TestTree(TestBase):
tree = self.rorepo.commit(tree).tree
num_blobs = 0
- for blob in tree.traverse(predicate = lambda e: e.type == "blob"):
+ blist = list()
+ for blob in tree.traverse(predicate = lambda e: e.type == "blob", branch_first=False):
assert (blob.path,0) in index.entries
- num_blobs += 1
+ blist.append(blob)
# END for each blob in tree
- assert num_blobs == len(index.entries)
+ if len(blist) != len(index.entries):
+ iset = set(k[0] for k in index.entries.keys())
+ bset = set(b.path for b in blist)
+ raise AssertionError( "CMP Failed: Missing entries in index: %s, missing in tree: %s" % (bset-iset, iset-bset) )
+ # END assertion message
def test_index_file_from_tree(self):
common_ancestor_sha = "5117c9c8a4d3af19a9958677e45cda9269de1541"
diff --git a/test/git/test_tree.py b/test/git/test_tree.py
index e0c1f134..2bfd9922 100644
--- a/test/git/test_tree.py
+++ b/test/git/test_tree.py
@@ -29,7 +29,7 @@ class TestTree(TestCase):
# limit recursion level to 0 - should be same as default iteration
assert all_items
assert 'CHANGES' in root
- assert len(list(root)) == len(list(root.traverse(max_depth=0)))
+ assert len(list(root)) == len(list(root.traverse(depth=1)))
# only choose trees
trees_only = lambda i: i.type == "tree"