diff --git a/github/AuthenticatedUser.py b/github/AuthenticatedUser.py index 2430c2d2..ad1523c4 100644 --- a/github/AuthenticatedUser.py +++ b/github/AuthenticatedUser.py @@ -50,6 +50,9 @@ class AuthenticatedUser(github.GithubObject.CompletableGithubObject): An AuthenticatedUser object can be created by calling ``get_user()`` on a Github object. """ + def __repr__(self): + return self.get__repr__({"login": self._login.value}) + @property def avatar_url(self): """ diff --git a/github/Authorization.py b/github/Authorization.py index f25977a4..11b4d9b4 100644 --- a/github/Authorization.py +++ b/github/Authorization.py @@ -35,6 +35,9 @@ class Authorization(github.GithubObject.CompletableGithubObject): This class represents Authorizations as returned for example by http://developer.github.com/v3/todo """ + def __repr__(self): + return self.get__repr__({"scopes": self._scopes.value}) + @property def app(self): """ diff --git a/github/AuthorizationApplication.py b/github/AuthorizationApplication.py index 5234cad6..63445fbf 100644 --- a/github/AuthorizationApplication.py +++ b/github/AuthorizationApplication.py @@ -33,6 +33,9 @@ class AuthorizationApplication(github.GithubObject.CompletableGithubObject): This class represents AuthorizationApplications as returned for example by http://developer.github.com/v3/todo """ + def __repr__(self): + return self.get__repr__({"name": self._name.value}) + @property def name(self): """ diff --git a/github/Branch.py b/github/Branch.py index 79d0b5a2..effc5bf6 100644 --- a/github/Branch.py +++ b/github/Branch.py @@ -36,6 +36,9 @@ class Branch(github.GithubObject.NonCompletableGithubObject): This class represents Branchs. The reference can be found here http://developer.github.com/v3/repos/#list-branches """ + def __repr__(self): + return self.get__repr__({"name": self._name.value}) + @property def commit(self): """ diff --git a/github/Commit.py b/github/Commit.py index a89d5eee..b84dfab7 100644 --- a/github/Commit.py +++ b/github/Commit.py @@ -43,6 +43,9 @@ class Commit(github.GithubObject.CompletableGithubObject): This class represents Commits. The reference can be found here http://developer.github.com/v3/git/commits/ """ + def __repr__(self): + return self.get__repr__({"sha": self._sha.value}) + @property def author(self): """ diff --git a/github/CommitCombinedStatus.py b/github/CommitCombinedStatus.py index 0f371e87..c2ef2967 100644 --- a/github/CommitCombinedStatus.py +++ b/github/CommitCombinedStatus.py @@ -36,6 +36,9 @@ class CommitCombinedStatus(github.GithubObject.NonCompletableGithubObject): This class represents CommitCombinedStatus as returned for example by https://developer.github.com/v3/repos/statuses/ """ + def __repr__(self): + return self.get__repr__({"sha": self._sha.value, "state": self._state.value}) + @property def state(self): """ diff --git a/github/CommitComment.py b/github/CommitComment.py index 205c6a6e..c338100e 100644 --- a/github/CommitComment.py +++ b/github/CommitComment.py @@ -35,6 +35,9 @@ class CommitComment(github.GithubObject.CompletableGithubObject): This class represents CommitComments as returned for example by http://developer.github.com/v3/todo """ + def __repr__(self): + return self.get__repr__({"id": self._id.value, "user": self.user}) + @property def body(self): """ diff --git a/github/CommitStatus.py b/github/CommitStatus.py index 16391f21..ff43d695 100644 --- a/github/CommitStatus.py +++ b/github/CommitStatus.py @@ -35,6 +35,13 @@ class CommitStatus(github.GithubObject.NonCompletableGithubObject): This class represents CommitStatuss as returned for example by https://developer.github.com/v3/repos/statuses/ """ + def __repr__(self): + return self.get__repr__({ + "id": self._id.value, + "state": self._state.value, + "context": self._context.value + }) + @property def created_at(self): """ diff --git a/github/ContentFile.py b/github/ContentFile.py index 18f4f094..2f69946b 100644 --- a/github/ContentFile.py +++ b/github/ContentFile.py @@ -40,6 +40,9 @@ class ContentFile(github.GithubObject.CompletableGithubObject): This class represents ContentFiles as returned for example by http://developer.github.com/v3/todo """ + def __repr__(self): + return self.get__repr__({"path": self._path.value}) + @property def content(self): """ diff --git a/github/Download.py b/github/Download.py index c91e3fe4..49acc489 100644 --- a/github/Download.py +++ b/github/Download.py @@ -33,6 +33,9 @@ class Download(github.GithubObject.CompletableGithubObject): This class represents Downloads as returned for example by http://developer.github.com/v3/todo """ + def __repr__(self): + return self.get__repr__({"id": self._id.value}) + @property def accesskeyid(self): """ diff --git a/github/Event.py b/github/Event.py index d9b9eabf..a769a230 100644 --- a/github/Event.py +++ b/github/Event.py @@ -38,6 +38,9 @@ class Event(github.GithubObject.NonCompletableGithubObject): This class represents Events. The reference can be found here http://developer.github.com/v3/activity/events/ """ + def __repr__(self): + return self.get__repr__({"id": self._id.value, "type": self._type.value}) + @property def actor(self): """ diff --git a/github/File.py b/github/File.py index 1fb3d7ab..d03efd3b 100644 --- a/github/File.py +++ b/github/File.py @@ -33,6 +33,9 @@ class File(github.GithubObject.NonCompletableGithubObject): This class represents Files as returned for example by http://developer.github.com/v3/todo """ + def __repr__(self): + return self.get__repr__({"sha": self._sha.value, "filename": self._filename.value}) + @property def additions(self): """ diff --git a/github/Gist.py b/github/Gist.py index 59204a1c..8d75e1e1 100644 --- a/github/Gist.py +++ b/github/Gist.py @@ -40,6 +40,9 @@ class Gist(github.GithubObject.CompletableGithubObject): This class represents Gists as returned for example by http://developer.github.com/v3/todo """ + def __repr__(self): + return self.get__repr__({"id": self._id.value}) + @property def comments(self): """ diff --git a/github/GistComment.py b/github/GistComment.py index 94254ac3..be1d08f7 100644 --- a/github/GistComment.py +++ b/github/GistComment.py @@ -35,6 +35,9 @@ class GistComment(github.GithubObject.CompletableGithubObject): This class represents GistComments as returned for example by http://developer.github.com/v3/todo """ + def __repr__(self): + return self.get__repr__({"id": self._id.value, "user": self._user.value}) + @property def body(self): """ diff --git a/github/GistFile.py b/github/GistFile.py index 73e45078..5778acfc 100644 --- a/github/GistFile.py +++ b/github/GistFile.py @@ -33,6 +33,9 @@ class GistFile(github.GithubObject.NonCompletableGithubObject): This class represents GistFiles as returned for example by http://developer.github.com/v3/todo """ + def __repr__(self): + return self.get__repr__({"filename": self._filename.value}) + @property def content(self): """ diff --git a/github/GitAuthor.py b/github/GitAuthor.py index 5609e7c2..324dcc14 100644 --- a/github/GitAuthor.py +++ b/github/GitAuthor.py @@ -33,6 +33,9 @@ class GitAuthor(github.GithubObject.NonCompletableGithubObject): This class represents GitAuthors as returned for example by http://developer.github.com/v3/todo """ + def __repr__(self): + return self.get__repr__({"name": self._name.value}) + @property def date(self): """ diff --git a/github/GitBlob.py b/github/GitBlob.py index 9461a934..3de1c6fb 100644 --- a/github/GitBlob.py +++ b/github/GitBlob.py @@ -33,6 +33,9 @@ class GitBlob(github.GithubObject.CompletableGithubObject): This class represents GitBlobs as returned for example by http://developer.github.com/v3/todo """ + def __repr__(self): + return self.get__repr__({"sha": self._sha.value}) + @property def content(self): """ diff --git a/github/GitCommit.py b/github/GitCommit.py index 06ca3504..9d43d51b 100644 --- a/github/GitCommit.py +++ b/github/GitCommit.py @@ -36,6 +36,9 @@ class GitCommit(github.GithubObject.CompletableGithubObject): This class represents GitCommits as returned for example by http://developer.github.com/v3/todo """ + def __repr__(self): + return self.get__repr__({"sha": self._sha.value}) + @property def author(self): """ diff --git a/github/GitObject.py b/github/GitObject.py index 771e34fb..0850061b 100644 --- a/github/GitObject.py +++ b/github/GitObject.py @@ -33,6 +33,9 @@ class GitObject(github.GithubObject.NonCompletableGithubObject): This class represents GitObjects as returned for example by http://developer.github.com/v3/todo """ + def __repr__(self): + return self.get__repr__({"sha": self._sha.value}) + @property def sha(self): """ diff --git a/github/GitRef.py b/github/GitRef.py index 34588523..417982fe 100644 --- a/github/GitRef.py +++ b/github/GitRef.py @@ -35,6 +35,9 @@ class GitRef(github.GithubObject.CompletableGithubObject): This class represents GitRefs as returned for example by http://developer.github.com/v3/todo """ + def __repr__(self): + return self.get__repr__({"ref": self._ref.value}) + @property def object(self): """ @@ -90,6 +93,22 @@ class GitRef(github.GithubObject.CompletableGithubObject): ) self._useAttributes(data) + def get_statuses(self): + """ + https://developer.github.com/v3/repos/statuses/#list-statuses-for-a-specific-ref + :calls: `GET /repos/:owner/:repo/commits/:ref/statuses` + :return: + """ + pass + + def get_status(self): + """ + https://developer.github.com/v3/repos/statuses/#get-the-combined-status-for-a-specific-ref + :calls: `GET /repos/:owner/:repo/commits/:ref/status` + :return: + """ + pass + def _initAttributes(self): self._object = github.GithubObject.NotSet self._ref = github.GithubObject.NotSet diff --git a/github/GitRelease.py b/github/GitRelease.py index cbe42c87..d36bc79c 100644 --- a/github/GitRelease.py +++ b/github/GitRelease.py @@ -31,6 +31,9 @@ class GitRelease(github.GithubObject.CompletableGithubObject): This class represents GitRelease as returned for example by https://developer.github.com/v3/repos/releases """ + def __repr__(self): + return self.get__repr__({"title": self._title.value}) + @property def body(self): """ diff --git a/github/GitTag.py b/github/GitTag.py index b53cacf3..347fd247 100644 --- a/github/GitTag.py +++ b/github/GitTag.py @@ -36,6 +36,9 @@ class GitTag(github.GithubObject.CompletableGithubObject): This class represents GitTags as returned for example by http://developer.github.com/v3/todo """ + def __repr__(self): + return self.get__repr__({"sha": self._sha.value, "tag": self._tag.value}) + @property def message(self): """ diff --git a/github/GitTree.py b/github/GitTree.py index f28a9aa8..8012bb77 100644 --- a/github/GitTree.py +++ b/github/GitTree.py @@ -35,6 +35,9 @@ class GitTree(github.GithubObject.CompletableGithubObject): This class represents GitTrees as returned for example by http://developer.github.com/v3/todo """ + def __repr__(self): + return self.get__repr__({"sha": self._sha.value}) + @property def sha(self): """ diff --git a/github/GitTreeElement.py b/github/GitTreeElement.py index 84299d82..907fb58f 100644 --- a/github/GitTreeElement.py +++ b/github/GitTreeElement.py @@ -33,6 +33,9 @@ class GitTreeElement(github.GithubObject.NonCompletableGithubObject): This class represents GitTreeElements as returned for example by http://developer.github.com/v3/todo """ + def __repr__(self): + return self.get__repr__({"sha": self._sha.value, "path": self._path.value}) + @property def mode(self): """ diff --git a/github/GithubObject.py b/github/GithubObject.py index d1cb4e95..c6841fdd 100644 --- a/github/GithubObject.py +++ b/github/GithubObject.py @@ -24,12 +24,15 @@ # along with PyGithub. If not, see . # # # # ############################################################################## - +import sys import datetime +from operator import itemgetter import GithubException import Consts +atLeastPython3 = sys.hexversion >= 0x03000000 + class _NotSetType: def __repr__(self): @@ -207,6 +210,22 @@ class GithubObject(object): ''' return self._headers.get(Consts.RES_LAST_MODIFED) + def get__repr__(self, params): + """ + Converts the object to a nicely printable string. + """ + def format_params(params): + if atLeastPython3: + items = params.items() + else: + items = list(params.items()) + for k, v in sorted(items, key=itemgetter(1)): + yield '{k}="{v}"'.format(k=k, v=v) if isinstance(v, (str, unicode)) else '{k}={v}'.format(k=k, v=v) + return '{class_name}({params})'.format( + class_name=self.__class__.__name__, + params=", ".join(list(format_params(params))) + ) + class NonCompletableGithubObject(GithubObject): def _completeIfNeeded(self): diff --git a/github/GitignoreTemplate.py b/github/GitignoreTemplate.py index 415c3245..55353dc3 100644 --- a/github/GitignoreTemplate.py +++ b/github/GitignoreTemplate.py @@ -32,6 +32,9 @@ class GitignoreTemplate(github.GithubObject.NonCompletableGithubObject): This class represents GitignoreTemplates as returned for example by http://developer.github.com/v3/todo """ + def __repr__(self): + return self.get__repr__({"name": self._name.value}) + @property def source(self): """ diff --git a/github/Hook.py b/github/Hook.py index df0e2f19..8e090059 100644 --- a/github/Hook.py +++ b/github/Hook.py @@ -35,6 +35,9 @@ class Hook(github.GithubObject.CompletableGithubObject): This class represents Hooks as returned for example by http://developer.github.com/v3/repos/hooks """ + def __repr__(self): + return self.get__repr__({"id": self._id.value, "url": self._url.value}) + @property def active(self): """ diff --git a/github/HookDescription.py b/github/HookDescription.py index 004643d9..d1058307 100644 --- a/github/HookDescription.py +++ b/github/HookDescription.py @@ -33,6 +33,9 @@ class HookDescription(github.GithubObject.NonCompletableGithubObject): This class represents HookDescriptions as returned for example by http://developer.github.com/v3/todo """ + def __repr__(self): + return self.get__repr__({"name": self._name.value}) + @property def events(self): """ diff --git a/github/HookResponse.py b/github/HookResponse.py index 44c8d258..bce05e39 100644 --- a/github/HookResponse.py +++ b/github/HookResponse.py @@ -33,6 +33,9 @@ class HookResponse(github.GithubObject.NonCompletableGithubObject): This class represents HookResponses as returned for example by http://developer.github.com/v3/todo """ + def __repr__(self): + return self.get__repr__({"status": self._status.value}) + @property def code(self): """ diff --git a/github/InputGitAuthor.py b/github/InputGitAuthor.py index e3f07393..f7a9ff14 100644 --- a/github/InputGitAuthor.py +++ b/github/InputGitAuthor.py @@ -46,6 +46,9 @@ class InputGitAuthor(object): self.__email = email self.__date = date + def __repr__(self): + return 'InputGitAuthor(name="{}")'.format(self.__name) + @property def _identity(self): identity = { diff --git a/github/Issue.py b/github/Issue.py index f6218b46..56ca46a4 100644 --- a/github/Issue.py +++ b/github/Issue.py @@ -47,6 +47,9 @@ class Issue(github.GithubObject.CompletableGithubObject): This class represents Issues as returned for example by http://developer.github.com/v3/todo """ + def __repr__(self): + return self.get__repr__({"number": self._number.value, "title": self._title.value}) + @property def assignee(self): """ diff --git a/github/IssueComment.py b/github/IssueComment.py index dfb8936c..8593a8cd 100644 --- a/github/IssueComment.py +++ b/github/IssueComment.py @@ -36,6 +36,9 @@ class IssueComment(github.GithubObject.CompletableGithubObject): This class represents IssueComments as returned for example by http://developer.github.com/v3/todo """ + def __repr__(self): + return self.get__repr__({"id": self._id.value, "user": self._user.value}) + @property def body(self): """ diff --git a/github/IssueEvent.py b/github/IssueEvent.py index ab874618..d55cd353 100644 --- a/github/IssueEvent.py +++ b/github/IssueEvent.py @@ -36,6 +36,9 @@ class IssueEvent(github.GithubObject.CompletableGithubObject): This class represents IssueEvents as returned for example by http://developer.github.com/v3/todo """ + def __repr__(self): + return self.get__repr__({"id": self._id.value}) + @property def actor(self): """ diff --git a/github/Label.py b/github/Label.py index 17ce7471..56e6d083 100644 --- a/github/Label.py +++ b/github/Label.py @@ -36,6 +36,9 @@ class Label(github.GithubObject.CompletableGithubObject): This class represents Labels. The reference can be found here http://developer.github.com/v3/issues/labels/ """ + def __repr__(self): + return self.get__repr__({"name": self._name.value}) + @property def color(self): """ diff --git a/github/Milestone.py b/github/Milestone.py index 37e8031a..ebe59df1 100644 --- a/github/Milestone.py +++ b/github/Milestone.py @@ -40,6 +40,9 @@ class Milestone(github.GithubObject.CompletableGithubObject): This class represents Milestones. The reference can be found here http://developer.github.com/v3/issues/milestones/ """ + def __repr__(self): + return self.get__repr__({"number": self._number.value}) + @property def closed_issues(self): """ diff --git a/github/NamedUser.py b/github/NamedUser.py index 63e567bf..2549e675 100644 --- a/github/NamedUser.py +++ b/github/NamedUser.py @@ -42,6 +42,9 @@ class NamedUser(github.GithubObject.CompletableGithubObject): This class represents NamedUsers as returned for example by http://developer.github.com/v3/todo """ + def __repr__(self): + return self.get__repr__({"login": self._login.value}) + @property def avatar_url(self): """ diff --git a/github/Notification.py b/github/Notification.py index 6a8e7397..b4b0205a 100644 --- a/github/Notification.py +++ b/github/Notification.py @@ -36,6 +36,9 @@ class Notification(github.GithubObject.CompletableGithubObject): This class represents Notifications. The reference can be found here http://developer.github.com/v3/activity/notifications/ """ + def __repr__(self): + return self.get__repr__({"id": self._id.value, "subject": self._subject.value}) + @property def id(self): """ diff --git a/github/NotificationSubject.py b/github/NotificationSubject.py index e6bf6031..c4289424 100644 --- a/github/NotificationSubject.py +++ b/github/NotificationSubject.py @@ -31,6 +31,9 @@ class NotificationSubject(github.GithubObject.NonCompletableGithubObject): This class represents Subjects of Notifications as returned for example by http://developer.github.com/v3/activity/notifications/#list-your-notifications """ + def __repr__(self): + return self.get__repr__({"title": self._title.value}) + @property def title(self): """ diff --git a/github/Organization.py b/github/Organization.py index 1727441f..90cce0d9 100644 --- a/github/Organization.py +++ b/github/Organization.py @@ -44,6 +44,9 @@ class Organization(github.GithubObject.CompletableGithubObject): This class represents Organizations. The reference can be found here http://developer.github.com/v3/orgs/ """ + def __repr__(self): + return self.get__repr__({"id": self._id.value, "name": self._name.value}) + @property def avatar_url(self): """ diff --git a/github/Permissions.py b/github/Permissions.py index 60c4cf96..3bb6faf8 100644 --- a/github/Permissions.py +++ b/github/Permissions.py @@ -33,6 +33,13 @@ class Permissions(github.GithubObject.NonCompletableGithubObject): This class represents Permissionss as returned for example by http://developer.github.com/v3/todo """ + def __repr__(self): + return self.get__repr__({ + "admin": self._admin.value, + "pull": self._pull.value, + "push": self._push.value + }) + @property def admin(self): """ diff --git a/github/Plan.py b/github/Plan.py index e266666c..0b6473ae 100644 --- a/github/Plan.py +++ b/github/Plan.py @@ -33,6 +33,9 @@ class Plan(github.GithubObject.NonCompletableGithubObject): This class represents Plans as returned for example by http://developer.github.com/v3/todo """ + def __repr__(self): + return self.get__repr__({"name": self._name.value}) + @property def collaborators(self): """ diff --git a/github/PullRequest.py b/github/PullRequest.py index 1bd8b137..1e7b3c83 100644 --- a/github/PullRequest.py +++ b/github/PullRequest.py @@ -44,6 +44,9 @@ class PullRequest(github.GithubObject.CompletableGithubObject): This class represents PullRequests. The reference can be found here http://developer.github.com/v3/pulls/ """ + def __repr__(self): + return self.get__repr__({"number": self._number.value, "title": self._title.value}) + @property def additions(self): """ diff --git a/github/PullRequestComment.py b/github/PullRequestComment.py index f04daed2..1decabad 100644 --- a/github/PullRequestComment.py +++ b/github/PullRequestComment.py @@ -37,6 +37,9 @@ class PullRequestComment(github.GithubObject.CompletableGithubObject): This class represents PullRequestComments. The reference can be found here http://developer.github.com/v3/pulls/comments/ """ + def __repr__(self): + return self.get__repr__({"id": self._id.value, "user": self._user.value}) + @property def body(self): """ diff --git a/github/PullRequestMergeStatus.py b/github/PullRequestMergeStatus.py index f77c63bf..a59adfa9 100644 --- a/github/PullRequestMergeStatus.py +++ b/github/PullRequestMergeStatus.py @@ -34,6 +34,9 @@ class PullRequestMergeStatus(github.GithubObject.NonCompletableGithubObject): This class represents PullRequestMergeStatuss. The reference can be found here http://developer.github.com/v3/pulls/#get-if-a-pull-request-has-been-merged """ + def __repr__(self): + return self.get__repr__({"sha": self._sha.value, "merged": self._merged.value}) + @property def merged(self): """ diff --git a/github/PullRequestPart.py b/github/PullRequestPart.py index 4717b991..8f03d6f1 100644 --- a/github/PullRequestPart.py +++ b/github/PullRequestPart.py @@ -36,6 +36,9 @@ class PullRequestPart(github.GithubObject.NonCompletableGithubObject): This class represents PullRequestParts as returned for example by http://developer.github.com/v3/todo """ + def __repr__(self): + return self.get__repr__({"sha": self._sha.value}) + @property def label(self): """ diff --git a/github/Rate.py b/github/Rate.py index 5603c6aa..5c7e4f5d 100644 --- a/github/Rate.py +++ b/github/Rate.py @@ -31,6 +31,9 @@ class Rate(github.GithubObject.NonCompletableGithubObject): This class represents rate limits as defined in http://developer.github.com/v3/rate_limit """ + def __repr__(self): + return self.get__repr__({"limit": self._limit.value, "remaining": self._remaining.value}) + @property def limit(self): """ diff --git a/github/RateLimit.py b/github/RateLimit.py index a0e7c40c..9ff0f08c 100644 --- a/github/RateLimit.py +++ b/github/RateLimit.py @@ -31,6 +31,9 @@ class RateLimit(github.GithubObject.NonCompletableGithubObject): This class represents rate limits as defined in http://developer.github.com/v3/rate_limit """ + def __repr__(self): + return self.get__repr__({"rate": self._rate.value}) + @property def rate(self): """ diff --git a/github/Repository.py b/github/Repository.py index d9ca93d0..4191d215 100644 --- a/github/Repository.py +++ b/github/Repository.py @@ -80,6 +80,9 @@ class Repository(github.GithubObject.CompletableGithubObject): This class represents Repositories. The reference can be found here http://developer.github.com/v3/repos/ """ + def __repr__(self): + return self.get__repr__({"full_name": self._full_name.value}) + @property def archive_url(self): """ diff --git a/github/RepositoryKey.py b/github/RepositoryKey.py index bca4172d..847b7f82 100644 --- a/github/RepositoryKey.py +++ b/github/RepositoryKey.py @@ -39,6 +39,9 @@ class RepositoryKey(github.GithubObject.CompletableGithubObject): github.GithubObject.CompletableGithubObject.__init__(self, requester, headers, attributes, completed) self.__repoUrl = repoUrl + def __repr__(self): + return self.get__repr__({"id": self._id.value}) + @property def __customUrl(self): return self.__repoUrl + "/keys/" + str(self.id) diff --git a/github/Stargazer.py b/github/Stargazer.py index 69d51026..6fca6a29 100644 --- a/github/Stargazer.py +++ b/github/Stargazer.py @@ -39,6 +39,10 @@ class Stargazer(github.GithubObject.NonCompletableGithubObject): This class represents Stargazers with the date of starring as returned by https://developer.github.com/v3/activity/starring/#alternative-response-with-star-creation-timestamps """ + + def __repr__(self): + return self.get__repr__({"user": self._user.value._login.value}) + @property def starred_at(self): """ diff --git a/github/Status.py b/github/Status.py index 731c4589..67a6b804 100644 --- a/github/Status.py +++ b/github/Status.py @@ -30,6 +30,9 @@ class Status(github.GithubObject.NonCompletableGithubObject): This class represents status as defined in https://status.github.com/api """ + def __repr__(self): + return self.get__repr__({"status": self._status.value}) + @property def status(self): """ diff --git a/github/StatusMessage.py b/github/StatusMessage.py index b3747511..ec081e39 100644 --- a/github/StatusMessage.py +++ b/github/StatusMessage.py @@ -30,6 +30,9 @@ class StatusMessage(github.GithubObject.NonCompletableGithubObject): This class represents status messages as defined in https://status.github.com/api """ + def __repr__(self): + return self.get__repr__({"body": self._body.value}) + @property def body(self): """ diff --git a/github/Tag.py b/github/Tag.py index 104ac60d..c837c74e 100644 --- a/github/Tag.py +++ b/github/Tag.py @@ -36,6 +36,12 @@ class Tag(github.GithubObject.NonCompletableGithubObject): This class represents Tags. The reference can be found here http://developer.github.com/v3/git/tags/ """ + def __repr__(self): + return self.get__repr__({ + "name": self._name.value, + "commit": self._commit.value + }) + @property def commit(self): """ diff --git a/github/Team.py b/github/Team.py index c0b0fa05..1cafdf45 100644 --- a/github/Team.py +++ b/github/Team.py @@ -38,6 +38,9 @@ class Team(github.GithubObject.CompletableGithubObject): This class represents Teams. The reference can be found here http://developer.github.com/v3/orgs/teams/ """ + def __repr__(self): + return self.get__repr__({"id": self._id.value, "name": self._name.value}) + @property def id(self): """ diff --git a/github/UserKey.py b/github/UserKey.py index 41353828..0f47cf08 100644 --- a/github/UserKey.py +++ b/github/UserKey.py @@ -34,6 +34,9 @@ class UserKey(github.GithubObject.CompletableGithubObject): This class represents UserKeys. The reference can be found here http://developer.github.com/v3/users/keys/ """ + def __repr__(self): + return self.get__repr__({"id": self._id.value, "title": self._title.value}) + @property def id(self): """ diff --git a/github/tests/AuthenticatedUser.py b/github/tests/AuthenticatedUser.py index ed511b2b..57dd1d59 100644 --- a/github/tests/AuthenticatedUser.py +++ b/github/tests/AuthenticatedUser.py @@ -65,6 +65,9 @@ class AuthenticatedUser(Framework.TestCase): self.assertEqual(self.user.type, "User") self.assertEqual(self.user.url, "https://api.github.com/users/jacquev6") + # test __repr__() based on this attributes + self.assertEqual(self.user.__repr__(), 'AuthenticatedUser(login="jacquev6")') + def testEditWithoutArguments(self): self.user.edit() diff --git a/github/tests/Branch.py b/github/tests/Branch.py index 69ec8aac..75447f55 100644 --- a/github/tests/Branch.py +++ b/github/tests/Branch.py @@ -36,6 +36,9 @@ class Branch(Framework.TestCase): self.assertEqual(self.branch.name, "topic/RewriteWithGeneratedCode") self.assertEqual(self.branch.commit.sha, "1292bf0e22c796e91cc3d6e24b544aece8c21f2a") + # test __repr__() based on this attributes + self.assertEqual(self.branch.__repr__(), 'Branch(name="topic/RewriteWithGeneratedCode")') + def testProtectedAttributes(self): self.branch = self.g.get_user().get_repo("PyGithub").get_protected_branch("master") self.assertEqual(self.branch.name, "master") diff --git a/github/tests/Commit.py b/github/tests/Commit.py index 2f720af3..fdb6a7e3 100644 --- a/github/tests/Commit.py +++ b/github/tests/Commit.py @@ -55,6 +55,9 @@ class Commit(Framework.TestCase): self.assertEqual(self.commit.stats.total, 20) self.assertEqual(self.commit.url, "https://api.github.com/repos/jacquev6/PyGithub/commits/1292bf0e22c796e91cc3d6e24b544aece8c21f2a") + # test __repr__() based on this attributes + self.assertEqual(self.commit.__repr__(), 'Commit(sha="1292bf0e22c796e91cc3d6e24b544aece8c21f2a")') + def testGetComments(self): self.assertListKeyEqual(self.commit.get_comments(), lambda c: c.id, [1347033, 1347083, 1347397, 1349654]) diff --git a/github/tests/CommitCombinedStatus.py b/github/tests/CommitCombinedStatus.py index afab7771..eb6c30b1 100644 --- a/github/tests/CommitCombinedStatus.py +++ b/github/tests/CommitCombinedStatus.py @@ -49,3 +49,7 @@ class CommitCombinedStatus(Framework.TestCase): self.assertEqual(self.combined_status.repository.full_name, "edx/edx-platform") self.assertEqual(self.combined_status.commit_url, "https://api.github.com/repos/edx/edx-platform/commits/74e70119a23fa3ffb3db19d4590eccfebd72b659") self.assertEqual(self.combined_status.url, "https://api.github.com/repos/edx/edx-platform/commits/74e70119a23fa3ffb3db19d4590eccfebd72b659/status") + + # test __repr__() based on this attributes + self.assertEqual(self.combined_status.__repr__(), + 'CommitCombinedStatus(sha="74e70119a23fa3ffb3db19d4590eccfebd72b659", state="success")') \ No newline at end of file diff --git a/github/tests/CommitComment.py b/github/tests/CommitComment.py index 9a3bdb0c..0bf45d1b 100644 --- a/github/tests/CommitComment.py +++ b/github/tests/CommitComment.py @@ -47,6 +47,10 @@ class CommitComment(Framework.TestCase): self.assertEqual(self.comment.url, "https://api.github.com/repos/jacquev6/PyGithub/comments/1361949") self.assertEqual(self.comment.user.login, "jacquev6") + # test __repr__() based on this attributes + self.assertEqual(self.comment.__repr__(), + 'CommitComment(id=1361949, user=NamedUser(login="jacquev6"))') + def testEdit(self): self.comment.edit("Comment edited by PyGithub") diff --git a/github/tests/CommitStatus.py b/github/tests/CommitStatus.py index e86443ac..99828e2a 100644 --- a/github/tests/CommitStatus.py +++ b/github/tests/CommitStatus.py @@ -47,3 +47,7 @@ class CommitStatus(Framework.TestCase): self.assertEqual(self.statuses[0].context, "build") self.assertEqual(self.statuses[0].target_url, "https://github.com/jacquev6/PyGithub/issues/67") self.assertEqual(self.statuses[1].target_url, None) + + # test __repr__() based on this attributes + self.assertEqual(self.statuses[0].__repr__(), + 'CommitStatus(id=277040, context="build", state="success")') \ No newline at end of file diff --git a/github/tests/ContentFile.py b/github/tests/ContentFile.py index e351bb6f..f05772ba 100644 --- a/github/tests/ContentFile.py +++ b/github/tests/ContentFile.py @@ -44,3 +44,6 @@ class ContentFile(Framework.TestCase): self.assertEqual(len(self.file.content), 10212) self.assertEqual(len(self.file.decoded_content), 7531) self.assertEqual(self.file.sha, "5628799a7d517a4aaa0c1a7004d07569cd154df0") + + # test __repr__() based on this attributes + self.assertEqual(self.file.__repr__(), 'ContentFile(path="ReadMe.md")') \ No newline at end of file diff --git a/github/tests/Download.py b/github/tests/Download.py index 4e9cbb54..1e9c0c9b 100644 --- a/github/tests/Download.py +++ b/github/tests/Download.py @@ -56,5 +56,8 @@ class Download(Framework.TestCase): self.assertEqual(self.download.size, 1024) self.assertEqual(self.download.url, "https://api.github.com/repos/jacquev6/PyGithub/downloads/242550") + # test __repr__() based on this attributes + self.assertEqual(self.download.__repr__(), 'Download(id=242550)') + def testDelete(self): self.download.delete() diff --git a/github/tests/Event.py b/github/tests/Event.py index 42b03198..3d5d4b80 100644 --- a/github/tests/Event.py +++ b/github/tests/Event.py @@ -43,3 +43,6 @@ class Event(Framework.TestCase): self.assertTrue(self.event.public) self.assertEqual(self.event.repo.name, "jacquev6/PyGithub") self.assertEqual(self.event.type, "PushEvent") + + # test __repr__() based on this attributes + self.assertEqual(self.event.__repr__(), 'Event(id="1556114751", type="PushEvent")') diff --git a/github/tests/Gist.py b/github/tests/Gist.py index 0da973be..43aa3394 100644 --- a/github/tests/Gist.py +++ b/github/tests/Gist.py @@ -66,6 +66,9 @@ class Gist(Framework.TestCase): self.assertEqual(gist.html_url, "https://gist.github.com/6296732") self.assertEqual(gist.url, "https://api.github.com/gists/6296732") + # test __repr__() based on this attributes + self.assertEqual(gist.__repr__(), 'Gist(id="6296732")') + def testEditWithoutParameters(self): gist = self.g.get_gist("2729810") gist.edit() diff --git a/github/tests/GistComment.py b/github/tests/GistComment.py index 293fd200..9e990a5d 100644 --- a/github/tests/GistComment.py +++ b/github/tests/GistComment.py @@ -42,6 +42,9 @@ class GistComment(Framework.TestCase): self.assertEqual(self.comment.url, "https://api.github.com/gists/2729810/comments/323629") self.assertEqual(self.comment.user.login, "jacquev6") + # test __repr__() based on this attributes + self.assertEqual(self.comment.__repr__(), 'GistComment(id=323629, user=NamedUser(login="jacquev6"))') + def testEdit(self): self.comment.edit("Comment edited by PyGithub") self.assertEqual(self.comment.body, "Comment edited by PyGithub") diff --git a/github/tests/GitBlob.py b/github/tests/GitBlob.py index 12a6384a..fcbc983c 100644 --- a/github/tests/GitBlob.py +++ b/github/tests/GitBlob.py @@ -40,3 +40,7 @@ class GitBlob(Framework.TestCase): self.assertEqual(self.blob.size, 1295) self.assertEqual(self.blob.sha, "53bce9fa919b4544e67275089b3ec5b44be20667") self.assertEqual(self.blob.url, "https://api.github.com/repos/jacquev6/PyGithub/git/blobs/53bce9fa919b4544e67275089b3ec5b44be20667") + + # test __repr__() based on this attributes + self.assertEqual(self.blob.__repr__(), + 'GitBlob(sha="53bce9fa919b4544e67275089b3ec5b44be20667")') \ No newline at end of file diff --git a/github/tests/GitCommit.py b/github/tests/GitCommit.py index eae4ab29..2d7c89ae 100644 --- a/github/tests/GitCommit.py +++ b/github/tests/GitCommit.py @@ -48,3 +48,7 @@ class GitCommit(Framework.TestCase): self.assertEqual(self.commit.sha, "4303c5b90e2216d927155e9609436ccb8984c495") self.assertEqual(self.commit.tree.sha, "f492784d8ca837779650d1fb406a1a3587a764ad") self.assertEqual(self.commit.url, "https://api.github.com/repos/jacquev6/PyGithub/git/commits/4303c5b90e2216d927155e9609436ccb8984c495") + + # test __repr__() based on this attributes + self.assertEqual(self.commit.__repr__(), + 'GitCommit(sha="4303c5b90e2216d927155e9609436ccb8984c495")') \ No newline at end of file diff --git a/github/tests/GitRef.py b/github/tests/GitRef.py index 6a5a03ae..c4c94da4 100644 --- a/github/tests/GitRef.py +++ b/github/tests/GitRef.py @@ -39,6 +39,10 @@ class GitRef(Framework.TestCase): self.assertEqual(self.ref.ref, "refs/heads/BranchCreatedByPyGithub") self.assertEqual(self.ref.url, "https://api.github.com/repos/jacquev6/PyGithub/git/refs/heads/BranchCreatedByPyGithub") + # test __repr__() based on this attributes + self.assertEqual(self.ref.__repr__(), + 'GitRef(ref="refs/heads/BranchCreatedByPyGithub")') + def testEdit(self): self.ref.edit("04cde900a0775b51f762735637bd30de392a2793") diff --git a/github/tests/GitRelease.py b/github/tests/GitRelease.py index 8cfb8323..955aca0a 100644 --- a/github/tests/GitRelease.py +++ b/github/tests/GitRelease.py @@ -40,6 +40,10 @@ class Release(Framework.TestCase): self.assertEqual(self.release.url, "https://api.github.com/repos/edhollandAL/PyGithub/releases/1210814") self.assertEqual(self.release.author._rawData['login'], "edhollandAL") + # test __repr__() based on this attributes + self.assertEqual(self.release.__repr__(), 'GitRelease(title="Test")') + + def testDelete(self): self.release = self.g.get_user().get_repo("PyGithub").get_releases()[0] self.assertTrue(self.release.delete_release()) diff --git a/github/tests/GitTag.py b/github/tests/GitTag.py index 707c84ce..374f2207 100644 --- a/github/tests/GitTag.py +++ b/github/tests/GitTag.py @@ -45,3 +45,6 @@ class GitTag(Framework.TestCase): self.assertEqual(self.tag.tagger.email, "vincent@vincent-jacques.net") self.assertEqual(self.tag.tagger.name, "Vincent Jacques") self.assertEqual(self.tag.url, "https://api.github.com/repos/jacquev6/PyGithub/git/tags/f5f37322407b02a80de4526ad88d5f188977bc3c") + + # test __repr__() based on this attributes + self.assertEqual(self.tag.__repr__(), 'GitTag(sha="f5f37322407b02a80de4526ad88d5f188977bc3c", tag="v0.6")') \ No newline at end of file diff --git a/github/tests/GitTree.py b/github/tests/GitTree.py index d94c0010..19f15a83 100644 --- a/github/tests/GitTree.py +++ b/github/tests/GitTree.py @@ -48,3 +48,6 @@ class GitTree(Framework.TestCase): self.assertEqual(self.tree.tree[6].type, "tree") self.assertEqual(self.tree.tree[6].url, "https://api.github.com/repos/jacquev6/PyGithub/git/trees/60b4602b2c2070246c5df078fb7a5150b45815eb") self.assertEqual(self.tree.url, "https://api.github.com/repos/jacquev6/PyGithub/git/trees/f492784d8ca837779650d1fb406a1a3587a764ad") + + # test __repr__() based on this attributes + self.assertEqual(self.tree.__repr__(), 'GitTree(sha="f492784d8ca837779650d1fb406a1a3587a764ad")') \ No newline at end of file diff --git a/github/tests/Hook.py b/github/tests/Hook.py index f3eb3dba..f55d1297 100644 --- a/github/tests/Hook.py +++ b/github/tests/Hook.py @@ -47,6 +47,9 @@ class Hook(Framework.TestCase): self.assertEqual(self.hook.updated_at, datetime.datetime(2012, 5, 29, 18, 49, 47)) self.assertEqual(self.hook.url, "https://api.github.com/repos/jacquev6/PyGithub/hooks/257993") + # test __repr__() based on this attributes + self.assertEqual(self.hook.__repr__(), 'Hook(id=257993, url="https://api.github.com/repos/jacquev6/PyGithub/hooks/257993")') + def testEditWithMinimalParameters(self): self.hook.edit("web", {"url": "http://foobar.com/hook"}) self.assertEqual(self.hook.config, {"url": "http://foobar.com/hook"}) diff --git a/github/tests/Issue.py b/github/tests/Issue.py index 89d31e10..846e13d5 100644 --- a/github/tests/Issue.py +++ b/github/tests/Issue.py @@ -58,6 +58,9 @@ class Issue(Framework.TestCase): self.assertEqual(self.issue.user.login, "jacquev6") self.assertEqual(self.issue.repository.name, "PyGithub") + # test __repr__() based on this attributes + self.assertEqual(self.issue.__repr__(), 'Issue(number=28, title="Issue created by PyGithub")') + def testEditWithoutParameters(self): self.issue.edit() diff --git a/github/tests/IssueComment.py b/github/tests/IssueComment.py index 6cd07d77..41821c2e 100644 --- a/github/tests/IssueComment.py +++ b/github/tests/IssueComment.py @@ -43,6 +43,9 @@ class IssueComment(Framework.TestCase): self.assertEqual(self.comment.user.login, "jacquev6") self.assertEqual(self.comment.html_url, "https://github.com/jacquev6/PyGithub/issues/28#issuecomment-5808311") + # test __repr__() based on this attributes + self.assertEqual(self.comment.__repr__(), 'IssueComment(id=5808311, user=NamedUser(login="jacquev6"))') + def testEdit(self): self.comment.edit("Comment edited by PyGithub") self.assertEqual(self.comment.body, "Comment edited by PyGithub") diff --git a/github/tests/IssueEvent.py b/github/tests/IssueEvent.py index 2c967e9f..5a6c72e0 100644 --- a/github/tests/IssueEvent.py +++ b/github/tests/IssueEvent.py @@ -42,3 +42,6 @@ class IssueEvent(Framework.TestCase): self.assertEqual(self.event.id, 16348656) self.assertEqual(self.event.issue.number, 30) self.assertEqual(self.event.url, "https://api.github.com/repos/jacquev6/PyGithub/issues/events/16348656") + + # test __repr__() based on this attributes + self.assertEqual(self.event.__repr__(), 'IssueEvent(id=16348656)') \ No newline at end of file diff --git a/github/tests/Label.py b/github/tests/Label.py index f5a3d6a0..09fe1a97 100644 --- a/github/tests/Label.py +++ b/github/tests/Label.py @@ -37,6 +37,9 @@ class Label(Framework.TestCase): self.assertEqual(self.label.name, "Bug") self.assertEqual(self.label.url, "https://api.github.com/repos/jacquev6/PyGithub/labels/Bug") + # test __repr__() based on this attributes + self.assertEqual(self.label.__repr__(), 'Label(name="Bug")') + def testEdit(self): self.label.edit("LabelEditedByPyGithub", "0000ff") self.assertEqual(self.label.color, "0000ff") diff --git a/github/tests/Milestone.py b/github/tests/Milestone.py index ee460845..136c1292 100644 --- a/github/tests/Milestone.py +++ b/github/tests/Milestone.py @@ -47,6 +47,9 @@ class Milestone(Framework.TestCase): self.assertEqual(self.milestone.url, "https://api.github.com/repos/jacquev6/PyGithub/milestones/1") self.assertEqual(self.milestone.creator.login, "jacquev6") + # test __repr__() based on this attributes + self.assertEqual(self.milestone.__repr__(), 'Milestone(number=1)') + def testEditWithMinimalParameters(self): self.milestone.edit("Title edited by PyGithub") self.assertEqual(self.milestone.title, "Title edited by PyGithub") diff --git a/github/tests/NamedUser.py b/github/tests/NamedUser.py index 8579d1b0..203921af 100644 --- a/github/tests/NamedUser.py +++ b/github/tests/NamedUser.py @@ -63,6 +63,10 @@ class NamedUser(Framework.TestCase): self.assertEqual(self.user.type, "User") self.assertEqual(self.user.url, "https://api.github.com/users/nvie") + # test __repr__() based on this attributes + self.assertEqual(self.user.__repr__(), 'NamedUser(login="nvie")') + + def testAttributesOfSelf(self): self.assertEqual(self.user.avatar_url, "https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png") self.assertEqual(self.user.bio, "") @@ -93,6 +97,9 @@ class NamedUser(Framework.TestCase): self.assertEqual(self.user.type, "User") self.assertEqual(self.user.url, "https://api.github.com/users/jacquev6") + # test __repr__() based on this attributes + self.assertEqual(self.user.__repr__(), 'NamedUser(login="jacquev6")') + def testGetGists(self): self.assertListKeyEqual(self.user.get_gists(), lambda g: g.description, ["Gist created by PyGithub", "FairThreadPoolPool.cpp", "How to error 500 Github API v3, as requested by Rick (GitHub Staff)", "Cadfael: order of episodes in French DVD edition"]) diff --git a/github/tests/Organization.py b/github/tests/Organization.py index 2d93bb81..aa7c76ec 100644 --- a/github/tests/Organization.py +++ b/github/tests/Organization.py @@ -62,6 +62,9 @@ class Organization(Framework.TestCase): self.assertEqual(self.org.type, "Organization") self.assertEqual(self.org.url, "https://api.github.com/orgs/BeaverSoftware") + # test __repr__() based on this attributes + self.assertEqual(self.org.__repr__(), 'Organization(name=None, id=1424031)') + def testEditWithoutArguments(self): self.org.edit() diff --git a/github/tests/PullRequest.py b/github/tests/PullRequest.py index c7b41c9b..a622d14f 100644 --- a/github/tests/PullRequest.py +++ b/github/tests/PullRequest.py @@ -68,6 +68,9 @@ class PullRequest(Framework.TestCase): self.assertEqual(self.pull.url, "https://api.github.com/repos/jacquev6/PyGithub/pulls/31") self.assertEqual(self.pull.user.login, "jacquev6") + # test __repr__() based on this attributes + self.assertEqual(self.pull.__repr__(), 'PullRequest(number=31, title="Title edited by PyGithub")') + def testCreateComment(self): commit = self.repo.get_commit("8a4f306d4b223682dd19410d4a9150636ebe4206") comment = self.pull.create_comment("Comment created by PyGithub", commit, "src/github/Issue.py", 5) diff --git a/github/tests/PullRequestComment.py b/github/tests/PullRequestComment.py index b74329f4..716e8442 100644 --- a/github/tests/PullRequestComment.py +++ b/github/tests/PullRequestComment.py @@ -48,6 +48,10 @@ class PullRequestComment(Framework.TestCase): self.assertEqual(self.comment.user.login, "jacquev6") self.assertEqual(self.comment.html_url, "https://github.com/jacquev6/PyGithub/pull/170#issuecomment-18637907") + # test __repr__() based on this attributes + self.assertEqual(self.comment.__repr__(), 'PullRequestComment(id=886298, user=NamedUser(login="jacquev6"))') + + def testEdit(self): self.comment.edit("Comment edited by PyGithub") self.assertEqual(self.comment.body, "Comment edited by PyGithub") diff --git a/github/tests/PullRequestFile.py b/github/tests/PullRequestFile.py index 385ca811..795333cb 100644 --- a/github/tests/PullRequestFile.py +++ b/github/tests/PullRequestFile.py @@ -42,3 +42,6 @@ class PullRequestFile(Framework.TestCase): self.assertEqual(self.file.raw_url, "https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/codegen/templates/GithubObject.py") self.assertEqual(self.file.sha, "8a4f306d4b223682dd19410d4a9150636ebe4206") self.assertEqual(self.file.status, "modified") + + # test __repr__() based on this attributes + self.assertEqual(self.file.__repr__(), 'File(sha="8a4f306d4b223682dd19410d4a9150636ebe4206", filename="codegen/templates/GithubObject.py")') diff --git a/github/tests/Repository.py b/github/tests/Repository.py index 08298c8f..0e93cc37 100644 --- a/github/tests/Repository.py +++ b/github/tests/Repository.py @@ -68,6 +68,9 @@ class Repository(Framework.TestCase): self.assertEqual(self.repo.url, "https://api.github.com/repos/jacquev6/PyGithub") self.assertEqual(self.repo.watchers, 15) + # test __repr__() based on this attributes + self.assertEqual(self.repo.__repr__(), 'Repository(full_name="jacquev6/PyGithub")') + def testProtectBranch(self): self.repo.protect_branch("master", True, "everyone", ["test"]) branch = self.repo.get_protected_branch("master") diff --git a/github/tests/RepositoryKey.py b/github/tests/RepositoryKey.py index 50d04196..a78a4ebd 100644 --- a/github/tests/RepositoryKey.py +++ b/github/tests/RepositoryKey.py @@ -39,6 +39,10 @@ class RepositoryKey(Framework.TestCase): self.assertEqual(self.key.url, "https://api.github.com/user/keys/2626761") self.assertTrue(self.key.verified) + # test __repr__() based on this attributes + self.assertEqual(self.key.__repr__(), 'RepositoryKey(id=2626761)') + + def testEdit(self): self.key.edit("Title edited by PyGithub", "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA5Q58YmzZjU64prR5Pk91MfeHezOTgLqDYmepYbv3qjguiHtPai1vSai5WvUv3hgf9DArXsXE5CV6yoBIhAdGtpJKExHuQ2m4XTFCdbrgfQ3ypcSdgzEiQemyTA6TWwhbuwjJ1IqJMYOVLH+FBCkD8pyIpUDO7v3vaR2TCEuNwOS7lbsRsW3OkGYnUKjaPaCTe/inrqb7I3OE8cPhWJ3dM/zzzBj22J4LCNKhjKua8TFS74xGm3lNDZ6/twQl4n4xmrH/3tG+WOJicNO3JohNHqK9T0pILnr3epEyfdkBjcG0qXApqWvH2WipJhaH6of8Gdr0Z/K/7p8QFddmwNgdPQ==") self.assertEqual(self.key.key, "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA5Q58YmzZjU64prR5Pk91MfeHezOTgLqDYmepYbv3qjguiHtPai1vSai5WvUv3hgf9DArXsXE5CV6yoBIhAdGtpJKExHuQ2m4XTFCdbrgfQ3ypcSdgzEiQemyTA6TWwhbuwjJ1IqJMYOVLH+FBCkD8pyIpUDO7v3vaR2TCEuNwOS7lbsRsW3OkGYnUKjaPaCTe/inrqb7I3OE8cPhWJ3dM/zzzBj22J4LCNKhjKua8TFS74xGm3lNDZ6/twQl4n4xmrH/3tG+WOJicNO3JohNHqK9T0pILnr3epEyfdkBjcG0qXApqWvH2WipJhaH6of8Gdr0Z/K/7p8QFddmwNgdPQ==") diff --git a/github/tests/Tag.py b/github/tests/Tag.py index 5d96fdeb..8150e881 100644 --- a/github/tests/Tag.py +++ b/github/tests/Tag.py @@ -37,3 +37,6 @@ class Tag(Framework.TestCase): self.assertEqual(self.tag.name, "v0.3") self.assertEqual(self.tag.tarball_url, "https://github.com/jacquev6/PyGithub/tarball/v0.3") self.assertEqual(self.tag.zipball_url, "https://github.com/jacquev6/PyGithub/zipball/v0.3") + + # test __repr__() based on this attributes + self.assertEqual(self.tag.__repr__(), 'Tag(commit=Commit(sha="636e6112deb72277b3bffcc3303cd7e8a7431a5d"), name="v0.3")') diff --git a/github/tests/Team.py b/github/tests/Team.py index 09de9da6..f7bcd268 100644 --- a/github/tests/Team.py +++ b/github/tests/Team.py @@ -41,6 +41,9 @@ class Team(Framework.TestCase): self.assertEqual(self.team.repos_count, 0) self.assertEqual(self.team.url, "https://api.github.com/teams/189850") + # test __repr__() based on this attributes + self.assertEqual(self.team.__repr__(), 'Team(id=189850, name="Team created by PyGithub")') + def testMembers(self): user = self.g.get_user("jacquev6") self.assertListKeyEqual(self.team.get_members(), None, []) diff --git a/github/tests/UserKey.py b/github/tests/UserKey.py index 4209cbb9..8e084220 100644 --- a/github/tests/UserKey.py +++ b/github/tests/UserKey.py @@ -39,6 +39,9 @@ class UserKey(Framework.TestCase): self.assertEqual(self.key.url, "https://api.github.com/user/keys/2626650") self.assertTrue(self.key.verified) + # test __repr__() based on this attributes + self.assertEqual(self.key.__repr__(), 'UserKey(id=2626650, title="Key added through PyGithub")') + def testEditWithoutArguments(self): self.key.edit()