summaryrefslogtreecommitdiff
path: root/test/test_commit.py
diff options
context:
space:
mode:
authorYuri Volchkov <yuri@volch.org>2021-02-05 11:22:54 +0100
committerYuri Volchkov <yuri.volchkov@gmail.com>2021-02-05 12:09:10 +0100
commitaf86f05d11c3613a418f7d3babfdc618e1cac805 (patch)
tree2baaca8c051eedd2f8d8164c9b053895fb3ba5f0 /test/test_commit.py
parent3c19a6e1004bb8c116bfc7823477118490a2eef6 (diff)
downloadgitpython-af86f05d11c3613a418f7d3babfdc618e1cac805.tar.gz
Fix inheritance issue at commit.iter_items
The iterator used to yield Commit() objects, which does not play well with inheritance. Yield cls() instead. Signed-off-by: Yuri Volchkov <yuri@volch.org>
Diffstat (limited to 'test/test_commit.py')
-rw-r--r--test/test_commit.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/test_commit.py b/test/test_commit.py
index 0292545f..7260a233 100644
--- a/test/test_commit.py
+++ b/test/test_commit.py
@@ -199,6 +199,13 @@ class TestCommit(TestCommitSerialization):
less_ltd_commits = list(Commit.iter_items(self.rorepo, 'master', paths=('CHANGES', 'AUTHORS')))
assert len(ltd_commits) < len(less_ltd_commits)
+ class Child(Commit):
+ def __init__(self, *args, **kwargs):
+ super(Child, self).__init__(*args, **kwargs)
+
+ child_commits = list(Child.iter_items(self.rorepo, 'master', paths=('CHANGES', 'AUTHORS')))
+ assert type(child_commits[0]) == Child
+
def test_iter_items(self):
# pretty not allowed
self.assertRaises(ValueError, Commit.iter_items, self.rorepo, 'master', pretty="raw")