mirror of
https://github.com/status-im/PyGithub.git
synced 2026-08-31 19:01:15 +00:00
Improve __repr__ method of Milestone class (#921)
This commit add the title of milestone in string representation of Milestone class. This modification improve readbility of milestone instances. Before: ```python >>> repo.get_milestone(number=1) Milestone(number=1) ``` After: ```python >>> repo.get_milestone(number=1) Milestone(title='Milestone Example', number=1) ```
This commit is contained in:
committed by
Wan Liuyang
parent
19165519a9
commit
562908cb17
+1
-1
@@ -45,7 +45,7 @@ class Milestone(github.GithubObject.CompletableGithubObject):
|
||||
"""
|
||||
|
||||
def __repr__(self):
|
||||
return self.get__repr__({"number": self._number.value})
|
||||
return self.get__repr__({"number": self._number.value, "title": self._title.value})
|
||||
|
||||
@property
|
||||
def closed_issues(self):
|
||||
|
||||
@@ -52,7 +52,7 @@ class Milestone(Framework.TestCase):
|
||||
self.assertEqual(self.milestone.creator.login, "jacquev6")
|
||||
|
||||
# test __repr__() based on this attributes
|
||||
self.assertEqual(self.milestone.__repr__(), 'Milestone(number=1)')
|
||||
self.assertEqual(self.milestone.__repr__(), 'Milestone(title="Version 0.4", number=1)')
|
||||
|
||||
def testEditWithMinimalParameters(self):
|
||||
self.milestone.edit("Title edited by PyGithub")
|
||||
|
||||
Reference in New Issue
Block a user