소스 검색

In dulwich.tests.test_object_store, use real sha lengths.

Jelmer Vernooij 10 년 전
부모
커밋
9e5c4bd169
1개의 변경된 파일21개의 추가작업 그리고 19개의 파일을 삭제
  1. 21 19
      dulwich/tests/test_object_store.py

+ 21 - 19
dulwich/tests/test_object_store.py

@@ -396,36 +396,38 @@ class TreeLookupPathTests(TestCase):
 class ObjectStoreGraphWalkerTests(TestCase):
 
     def get_walker(self, heads, parent_map):
-        return ObjectStoreGraphWalker(heads,
-            parent_map.__getitem__)
+        new_parent_map = dict([
+            (k * 40, [(p * 40) for p in ps]) for (k, ps) in parent_map.items()])
+        return ObjectStoreGraphWalker([x * 40 for x in heads],
+            new_parent_map.__getitem__)
 
     def test_empty(self):
         gw = self.get_walker([], {})
         self.assertIs(None, next(gw))
-        gw.ack("aa" * 20)
+        gw.ack("a" * 40)
         self.assertIs(None, next(gw))
 
     def test_descends(self):
         gw = self.get_walker(["a"], {"a": ["b"], "b": []})
-        self.assertEqual("a", next(gw))
-        self.assertEqual("b", next(gw))
+        self.assertEqual("a" * 40, next(gw))
+        self.assertEqual("b" * 40, next(gw))
 
     def test_present(self):
         gw = self.get_walker(["a"], {"a": ["b"], "b": []})
-        gw.ack("a")
+        gw.ack("a" * 40)
         self.assertIs(None, next(gw))
 
     def test_parent_present(self):
         gw = self.get_walker(["a"], {"a": ["b"], "b": []})
-        self.assertEqual("a", next(gw))
-        gw.ack("a")
+        self.assertEqual("a" * 40, next(gw))
+        gw.ack("a" * 40)
         self.assertIs(None, next(gw))
 
     def test_child_ack_later(self):
         gw = self.get_walker(["a"], {"a": ["b"], "b": ["c"], "c": []})
-        self.assertEqual("a", next(gw))
-        self.assertEqual("b", next(gw))
-        gw.ack("a")
+        self.assertEqual("a" * 40, next(gw))
+        self.assertEqual("b" * 40, next(gw))
+        gw.ack("a" * 40)
         self.assertIs(None, next(gw))
 
     def test_only_once(self):
@@ -447,18 +449,18 @@ class ObjectStoreGraphWalkerTests(TestCase):
         walk.append(next(gw))
         # A branch (a, c) or (b, d) may be done after 2 steps or 3 depending on
         # the order walked: 3-step walks include (a, b, c) and (b, a, d), etc.
-        if walk == ["a", "c"] or walk == ["b", "d"]:
+        if walk == ["a" * 40, "c" * 40] or walk == ["b" * 40, "d" * 40]:
           gw.ack(walk[0])
           acked = True
 
         walk.append(next(gw))
-        if not acked and walk[2] == "c":
-          gw.ack("a")
-        elif not acked and walk[2] == "d":
-          gw.ack("b")
+        if not acked and walk[2] == "c" * 40:
+          gw.ack("a" * 40)
+        elif not acked and walk[2] == "d" * 40:
+          gw.ack("b" * 40)
         walk.append(next(gw))
         self.assertIs(None, next(gw))
 
-        self.assertEqual(["a", "b", "c", "d"], sorted(walk))
-        self.assertLess(walk.index("a"), walk.index("c"))
-        self.assertLess(walk.index("b"), walk.index("d"))
+        self.assertEqual(["a" * 40, "b" * 40, "c" * 40, "d" * 40], sorted(walk))
+        self.assertLess(walk.index("a" * 40), walk.index("c" * 40))
+        self.assertLess(walk.index("b" * 40), walk.index("d" * 40))