Clarify make_commit docstring and variable names.
authorDave Borowitz <dborowitz@google.com>
Thu, 25 Mar 2010 22:13:36 +0000 (15:13 -0700)
committerDave Borowitz <dborowitz@google.com>
Fri, 30 Apr 2010 16:42:54 +0000 (09:42 -0700)
Change-Id: Ifccc31a7bb78adcbb539f360cc62a1e76e7f7943

dulwich/tests/utils.py

index f300aa3698e7235721779a97d4cc3d294ac320aa..f2ae54ac07cd8f8213c6c184a2a32d0ee57b6503 100644 (file)
@@ -66,17 +66,21 @@ def make_object(cls, **attrs):
     return obj
 
 
-def make_commit(**kwargs):
-    """Make a Commit object with a default set of members."""
+def make_commit(**attrs):
+    """Make a Commit object with a default set of members.
+
+    :param attrs: dict of attributes to overwrite from the default values.
+    :return: A newly initialized Commit object.
+    """
     default_time = int(time.mktime(datetime.datetime(2010, 1, 1).timetuple()))
-    attrs = {'author': 'Test Author <test@nodomain.com>',
-             'author_time': default_time,
-             'author_timezone': 0,
-             'committer': 'Test Committer <test@nodomain.com>',
-             'commit_time': default_time,
-             'commit_timezone': 0,
-             'message': 'Test message.',
-             'parents': [],
-             'tree': '0' * 40}
-    attrs.update(kwargs)
-    return make_object(Commit, **attrs)
+    all_attrs = {'author': 'Test Author <test@nodomain.com>',
+                 'author_time': default_time,
+                 'author_timezone': 0,
+                 'committer': 'Test Committer <test@nodomain.com>',
+                 'commit_time': default_time,
+                 'commit_timezone': 0,
+                 'message': 'Test message.',
+                 'parents': [],
+                 'tree': '0' * 40}
+    all_attrs.update(attrs)
+    return make_object(Commit, **all_attrs)