فهرست منبع

test_walk: Simplify commit_time attr assignment.

Change-Id: I5818da44121a89eec590e52b8b0053d839e4713a
Dave Borowitz 13 سال پیش
والد
کامیت
1825c2dd05
1فایلهای تغییر یافته به همراه8 افزوده شده و 4 حذف شده
  1. 8 4
      dulwich/tests/test_walk.py

+ 8 - 4
dulwich/tests/test_walk.py

@@ -72,7 +72,12 @@ class WalkerTest(TestCase):
         self.store = MemoryObjectStore()
 
     def make_commits(self, commit_spec, **kwargs):
-        return build_commit_graph(self.store, commit_spec, **kwargs)
+        times = kwargs.pop('times', [])
+        attrs = kwargs.pop('attrs', {})
+        for i, t in enumerate(times):
+            attrs.setdefault(i + 1, {})['commit_time'] = t
+        return build_commit_graph(self.store, commit_spec, attrs=attrs,
+                                  **kwargs)
 
     def make_linear_commits(self, num_commits, **kwargs):
         commit_spec = []
@@ -330,9 +335,8 @@ class WalkerTest(TestCase):
         self.assertWalkYields([c2], [c3.id], since=50, until=150)
 
     def test_since_over_scan(self):
-        times = [9, 0, 1, 2, 3, 4, 5, 8, 6, 7, 9]
-        attrs = dict((i + 1, {'commit_time': t}) for i, t in enumerate(times))
-        commits = self.make_linear_commits(11, attrs=attrs)
+        commits = self.make_linear_commits(
+          11, times=[9, 0, 1, 2, 3, 4, 5, 8, 6, 7, 9])
         c8, _, c10, c11 = commits[-4:]
         del self.store[commits[0].id]
         # c9 is older than we want to walk, but is out of order with its parent,