Skip to content

Commit dcc4676

Browse files
committed
Use _instance_or_null in github3.issues.issue
1 parent 883531a commit dcc4676

2 files changed

Lines changed: 2 additions & 5 deletions

File tree

github3/issues/issue.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ def comment(self, id_num):
153153
url = self._build_url('repos', owner, repo, 'issues', 'comments',
154154
str(id_num))
155155
json = self._json(self._get(url), 200)
156-
return IssueComment(json) if json else None
156+
return self._instance_or_null(IssueComment, json)
157157

158158
def comments(self, number=-1):
159159
r"""Iterate over the comments on this issue.
@@ -177,7 +177,7 @@ def create_comment(self, body):
177177
url = self._build_url('comments', base_url=self._api)
178178
json = self._json(self._post(url, data={'body': body}),
179179
201)
180-
return IssueComment(json, self) if json else None
180+
return self._instance_or_null(IssueComment, json)
181181

182182
@requires_auth
183183
def edit(self, title=None, body=None, assignee=None, state=None,

tests/test_issues.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -203,9 +203,6 @@ def test_create_comment(self):
203203
self.assertRaises(github3.GitHubError, self.i.create_comment, '')
204204

205205
self.login()
206-
assert self.i.create_comment(None) is None
207-
self.not_called()
208-
209206
assert isinstance(self.i.create_comment('comment body'), IssueComment)
210207
self.mock_assertions()
211208

0 commit comments

Comments
 (0)