Skip to content

Commit 929c388

Browse files
committed
Add the body_{html,text} attributes to Issue.
Apparently I never added these. Seems odd since I chose to use the full version of the API for this reason exactly.
1 parent 4c58f57 commit 929c388

2 files changed

Lines changed: 13 additions & 3 deletions

File tree

github3/issues.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,11 +150,15 @@ def __init__(self, issue, session=None):
150150
self._api = issue.get('url', '')
151151
#: :class:`User <github3.users.User>` representing the user the issue
152152
# was assigned to.
153-
self.assignee = None
154-
if issue.get('assignee'):
153+
self.assignee = issue.get('assignee')
154+
if self.assignee:
155155
self.assignee = User(issue.get('assignee'), self._session)
156156
#: Body (description) of the issue.
157-
self.body = issue.get('body')
157+
self.body = issue.get('body', '')
158+
#: HTML formatted body of the issue.
159+
self.body_html = issue.get('body_html', '')
160+
#: Plain text formatted body of the issue.
161+
self.body_text = issue.get('body_text', '')
158162

159163
# If an issue is still open, this field will be None
160164
#: datetime object representing when the issue was closed.

tests/test_issues.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ def test_assignee(self):
2929
def test_body(self):
3030
expect(self.issue.body).isinstance(str_test)
3131

32+
def test_body_html(self):
33+
expect(self.issue.body_html).isinstance(str_test)
34+
35+
def test_body_text(self):
36+
expect(self.issue.body_text).isinstance(str_test)
37+
3238
def test_created_at(self):
3339
expect(self.issue.created_at).isinstance(datetime)
3440

0 commit comments

Comments
 (0)