Show More
@@ -628,7 +628,8 b' class BaseCommit(object):' | |||||
628 | return u'%s:%s' % (self.idx, self.short_id) |
|
628 | return u'%s:%s' % (self.idx, self.short_id) | |
629 |
|
629 | |||
630 | def __eq__(self, other): |
|
630 | def __eq__(self, other): | |
631 | return self.raw_id == other.raw_id |
|
631 | same_instance = isinstance(other, self.__class__) | |
|
632 | return same_instance and self.raw_id == other.raw_id | |||
632 |
|
633 | |||
633 | def __json__(self): |
|
634 | def __json__(self): | |
634 | parents = [] |
|
635 | parents = [] |
@@ -465,6 +465,19 b' class TestCommits(BackendTestMixin):' | |||||
465 | with pytest.raises(TypeError): |
|
465 | with pytest.raises(TypeError): | |
466 | self.repo.get_commits(start_id=1, end_id=2) |
|
466 | self.repo.get_commits(start_id=1, end_id=2) | |
467 |
|
467 | |||
|
468 | def test_commit_equality(self): | |||
|
469 | commit1 = self.repo.get_commit(self.repo.commit_ids[0]) | |||
|
470 | commit2 = self.repo.get_commit(self.repo.commit_ids[1]) | |||
|
471 | ||||
|
472 | assert commit1 == commit1 | |||
|
473 | assert commit2 == commit2 | |||
|
474 | assert commit1 != commit2 | |||
|
475 | assert commit2 != commit1 | |||
|
476 | assert commit1 != None | |||
|
477 | assert None != commit1 | |||
|
478 | assert 1 != commit1 | |||
|
479 | assert 'string' != commit1 | |||
|
480 | ||||
468 |
|
481 | |||
469 | @pytest.mark.parametrize("filename, expected", [ |
|
482 | @pytest.mark.parametrize("filename, expected", [ | |
470 | ("README.rst", False), |
|
483 | ("README.rst", False), |
General Comments 0
You need to be logged in to leave comments.
Login now