Skip to content

Commit d6e7806

Browse files
committed
raise TypeError when creating pull requests if one of the alternative arguments is not given
1 parent 0f64b16 commit d6e7806

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

github2/pull_requests.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ def create(self, project, base, head, title=None, body=None, issue=None):
6767
post_data["title"] = title
6868
if body:
6969
post_data["body"] = body
70+
else:
71+
raise TypeError("You must either specify a title for the "
72+
"pull request or an issue number to which the "
73+
"pull request should be attached.")
7074
pull_request_data = [("pull[%s]" % k, v) for k, v in post_data.items()]
7175
return self.get_value(project, post_data=dict(pull_request_data),
7276
filter="pull", datatype=PullRequest)

0 commit comments

Comments
 (0)