8000 Add iter_review_comments · staticdev/github4.py@bab14ba · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on May 22, 2021. It is now read-only.

Commit bab14ba

Browse files
committed
Add iter_review_comments
1 parent 58711b0 commit bab14ba

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

github3/pulls.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,17 @@ def iter_issue_comments(self, number=-1, etag=None):
299299
url = self._build_url(base_url=self.links['comments'])
300300
return self._iter(int(number), url, IssueComment, etag=etag)
301301

302+
def iter_review_comments(self, number=-1, etag=None):
303+
r"""Iterate over the review comments on this pull request.
304+
:param int number: (optional), number of comments to return. Default:
305+
-1 returns all available comments.
306+
:param str etag: (optional), ETag from a previous request to the same
307+
endpoint
308+
:returns: generator of :class:`ReviewComment <ReviewComment>`\ s
309+
"""
310+
url = self._build_url('comments', base_url=self._api)
311+
return self._iter(int(number), url, ReviewComment, etag=etag)
312+
302313
@requires_auth
303314
def merge(self, commit_message=''):
304315
"""Merge this pull request.

tests/integration/test_pulls.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,6 @@ def test_reply(self):
4242
cassette_name = self.cassette_name('reply')
4343
with self.recorder.use_cassette(cassette_name):
4444
p = self.gh.pull_request('sigmavirus24', 'github3.py', 286)
45-
c = next(p.review_comments())
45+
c = next(p.iter_review_comments())
4646
comment = c.reply('Replying to comments is fun.')
4747
assert isinstance(comment, github3.pulls.ReviewComment)

0 commit comments

Comments
 (0)
0