From bd28524853af4cce1ce7d82ae5b6fbe28500d2e7 Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Tue, 23 Apr 2019 14:31:02 -0400 Subject: [PATCH] Add draft attribute, update test --- github/PullRequest.py | 11 +++++++++++ tests/PullRequest.py | 1 + 2 files changed, 12 insertions(+) diff --git a/github/PullRequest.py b/github/PullRequest.py index 42418a2b..dd1be134 100644 --- a/github/PullRequest.py +++ b/github/PullRequest.py @@ -181,6 +181,14 @@ class PullRequest(github.GithubObject.CompletableGithubObject): self._completeIfNotSet(self._diff_url) return self._diff_url.value + @property + def draft(self): + """ + :type: bool + """ + self._completeIfNotSet(self._draft) + return self._draft.value + @property def head(self): """ @@ -924,6 +932,7 @@ class PullRequest(github.GithubObject.CompletableGithubObject): self._created_at = github.GithubObject.NotSet self._deletions = github.GithubObject.NotSet self._diff_url = github.GithubObject.NotSet + self._draft = github.GithubObject.NotSet self._head = github.GithubObject.NotSet self._html_url = github.GithubObject.NotSet self._id = github.GithubObject.NotSet @@ -991,6 +1000,8 @@ class PullRequest(github.GithubObject.CompletableGithubObject): self._deletions = self._makeIntAttribute(attributes["deletions"]) if "diff_url" in attributes: # pragma no branch self._diff_url = self._makeStringAttribute(attributes["diff_url"]) + if "draft" in attributes: # pragma no branch + self._draft = self._makeBoolAttribute(attributes["draft"]) if "head" in attributes: # pragma no branch self._head = self._makeClassAttribute( github.PullRequestPart.PullRequestPart, attributes["head"] diff --git a/tests/PullRequest.py b/tests/PullRequest.py index 36290dfe..90ca46cd 100644 --- a/tests/PullRequest.py +++ b/tests/PullRequest.py @@ -133,6 +133,7 @@ class PullRequest(Framework.TestCase): self.pull.url, "https://api.github.com/repos/jacquev6/PyGithub/pulls/31" ) self.assertEqual(self.pull.user.login, "jacquev6") + self.assertEqual(self.pull.draft, None) # test __repr__() based on this attributes self.assertEqual(