From 4933459e6b85b0ff0b10bc9df435e6d9604bfd2d Mon Sep 17 00:00:00 2001 From: vanya20074 Date: Fri, 21 Jul 2023 20:02:14 +0300 Subject: [PATCH] Fix assertion for subject_type in creating pull request review comment (#2642) Co-authored-by: Enrico Minack --- github/PullRequest.py | 4 ++-- tests/PullRequest.py | 2 +- .../PullRequest.testCreateReviewCommentSubjectType.txt | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/github/PullRequest.py b/github/PullRequest.py index 6be88c95..7b982cf8 100644 --- a/github/PullRequest.py +++ b/github/PullRequest.py @@ -448,8 +448,8 @@ class PullRequest(github.GithubObject.CompletableGithubObject): ], start_side assert in_reply_to is github.GithubObject.NotSet or isinstance(in_reply_to, int), in_reply_to assert subject_type is github.GithubObject.NotSet or subject_type in [ - "LINE", - "FILE", + "line", + "file", "side", ], subject_type assert isinstance(as_suggestion, bool), as_suggestion diff --git a/tests/PullRequest.py b/tests/PullRequest.py index c6c2a909..296bddbf 100644 --- a/tests/PullRequest.py +++ b/tests/PullRequest.py @@ -166,7 +166,7 @@ class PullRequest(Framework.TestCase): commit, "src/github/Issue.py", 5, - subject_type="FILE", + subject_type="file", ) self.assertEqual(comment.id, 886298) diff --git a/tests/ReplayData/PullRequest.testCreateReviewCommentSubjectType.txt b/tests/ReplayData/PullRequest.testCreateReviewCommentSubjectType.txt index 7104dc41..d34e1745 100644 --- a/tests/ReplayData/PullRequest.testCreateReviewCommentSubjectType.txt +++ b/tests/ReplayData/PullRequest.testCreateReviewCommentSubjectType.txt @@ -15,7 +15,7 @@ api.github.com None /repos/PyGithub/PyGithub/pulls/31/comments {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} -{"body": "Comment created by PyGithub", "commit_id": "8a4f306d4b223682dd19410d4a9150636ebe4206", "line": 5, "path": "src/github/Issue.py", "subject_type": "FILE"} +{"body": "Comment created by PyGithub", "commit_id": "8a4f306d4b223682dd19410d4a9150636ebe4206", "line": 5, "path": "src/github/Issue.py", "subject_type": "file"} 201 [('status', '201 Created'), ('x-ratelimit-remaining', '4953'), ('content-length', '937'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"7ca841d45253326d61bee20c809872dc"'), ('date', 'Sun, 27 May 2012 09:40:12 GMT'), ('content-type', 'application/json; charset=utf-8'), ('location', 'https://api.github.com/repos/jacquev6/PyGithub/pulls/comments/886298')] {"updated_at":"2012-05-27T09:40:12Z","line":5,"original_position":5,"body":"Comment created by PyGithub","url":"https://api.github.com/repos/jacquev6/PyGithub/pulls/comments/886298","commit_id":"8a4f306d4b223682dd19410d4a9150636ebe4206","created_at":"2012-05-27T09:40:12Z","user":{"url":"https://api.github.com/users/jacquev6","avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"jacquev6","id":327146},"original_commit_id":"8a4f306d4b223682dd19410d4a9150636ebe4206","path":"src/github/Issue.py","id":886298,"_links":{"self":{"href":"https://api.github.com/repos/jacquev6/PyGithub/pulls/comments/886298"},"html":{"href":"https://github.com/jacquev6/PyGithub/pull/31#r886298"},"pull_request":{"href":"https://api.github.com/repos/jacquev6/PyGithub/pulls/31"}}}