summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSebastian Thiel <byronimo@gmail.com>2009-10-23 23:44:49 +0200
committerSebastian Thiel <byronimo@gmail.com>2009-10-24 00:06:55 +0200
commitb999cae064fb6ac11a61a39856e074341baeefde (patch)
tree853234aec20b28092832e346a958a422ff68deb2 /test
parent0cd09bd306486028f5442c56ef2e947355a06282 (diff)
downloadgitpython-b999cae064fb6ac11a61a39856e074341baeefde.tar.gz
actor: added __eq__, __ne__ and __hash__ methods including simple test
commit: Fixed long-standing issue during message parsing that would fail to parse properly in case we were created from data. Also it would strip white space from the messages although it shouldn't
Diffstat (limited to 'test')
-rw-r--r--test/git/test_actor.py8
-rw-r--r--test/git/test_commit.py13
2 files changed, 20 insertions, 1 deletions
diff --git a/test/git/test_actor.py b/test/git/test_actor.py
index b7c2af7c..2941468d 100644
--- a/test/git/test_actor.py
+++ b/test/git/test_actor.py
@@ -13,6 +13,14 @@ class TestActor(object):
a = Actor._from_string("Michael Trier <mtrier@example.com>")
assert_equal("Michael Trier", a.name)
assert_equal("mtrier@example.com", a.email)
+
+ # base type capabilities
+ assert a == a
+ assert not ( a != a )
+ m = set()
+ m.add(a)
+ m.add(a)
+ assert len(m) == 1
def test_from_string_should_handle_just_name(self):
a = Actor._from_string("Michael Trier")
diff --git a/test/git/test_commit.py b/test/git/test_commit.py
index c4ed4b72..da636a2b 100644
--- a/test/git/test_commit.py
+++ b/test/git/test_commit.py
@@ -16,6 +16,9 @@ class TestCommit(TestBase):
assert_equal("Sebastian Thiel", commit.author.name)
assert_equal("byronimo@gmail.com", commit.author.email)
+ assert commit.author == commit.committer
+ assert isinstance(commit.authored_date, int) and isinstance(commit.committed_date, int)
+ assert commit.message == "Added missing information to docstrings of commit and stats module"
def test_stats(self):
@@ -37,6 +40,14 @@ class TestCommit(TestBase):
check_entries(d)
# END for each stated file
+ # assure data is parsed properly
+ michael = Actor._from_string("Michael Trier <mtrier@gmail.com>")
+ assert commit.author == michael
+ assert commit.committer == michael
+ assert commit.authored_date == 1210193388
+ assert commit.committed_date == 1210193388
+ assert commit.message == "initial project"
+
@patch_object(Git, '_call_process')
def test_rev_list_bisect_all(self, git):
"""
@@ -52,7 +63,7 @@ class TestCommit(TestBase):
bisect_all=True)
assert_true(git.called)
- commits = Commit._iter_from_process_or_stream(self.rorepo, ListProcessAdapter(revs))
+ commits = Commit._iter_from_process_or_stream(self.rorepo, ListProcessAdapter(revs), True)
expected_ids = (
'cf37099ea8d1d8c7fbf9b6d12d7ec0249d3acb8b',
'33ebe7acec14b25c5f84f35a664803fcab2f7781',