Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit17d0fb9

Browse files
authored
Merge pull requestsigmavirus24#778 from matthew-23/develop
fix bug#777: close issue failed with unicode labels
2 parentsf8487f7 +8cd184d commit17d0fb9

File tree

2 files changed

+20
-7
lines changed

2 files changed

+20
-7
lines changed

‎github3/issues/issue.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,8 @@ def close(self):
147147
"""
148148
assignee=self.assignee.loginifself.assigneeelse''
149149
number=self.milestone.numberifself.milestoneelseNone
150-
labels= [str(l)forlinself.original_labels]
150+
labels= [l.nameforlinself.original_labels]
151+
151152
returnself.edit(self.title,self.body,assignee,'closed',
152153
number,labels)
153154

‎tests/unit/test_issues_issue.py‎

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# -*- coding: utf-8 -*-
12
"""Unit tests for the Issue class."""
23
importgithub3
34
importmock
@@ -31,7 +32,6 @@
3132

3233

3334
classTestIssueRequiresAuth(helper.UnitRequiresAuthenticationHelper):
34-
3535
"""Test Issue methods that require Authentication."""
3636

3737
described_class=github3.issues.Issue
@@ -83,7 +83,6 @@ def test_unlock(self):
8383

8484

8585
classTestIssue(helper.UnitHelper):
86-
8786
"""Test Issue methods that make simple requests."""
8887

8988
described_class=github3.issues.Issue
@@ -120,7 +119,8 @@ def test_assign_empty_username(self):
120119
deftest_close(self):
121120
"""Verify the request for closing an issue."""
122121
self.instance.close()
123-
labels= [str(label)forlabelinself.instance.original_labels]
122+
labels= [label.nameforlabelinself.instance.original_labels]
123+
124124
self.patch_called_with(
125125
url_for(),
126126
data={
@@ -169,6 +169,21 @@ def test_comment_positive_id(self):
169169
self.instance.comment(-1)
170170
assertself.session.get.calledisFalse
171171

172+
deftest_close_with_unicode_labels(self):
173+
"""Verify the request for closing an issue."""
174+
data= {
175+
'title':'issue title',
176+
'body':'issue body',
177+
'assignee':'sigmavirus24',
178+
'state':'closed',
179+
'labels': [u"标签1",u"标签2"]
180+
}
181+
self.instance.edit(**data)
182+
self.patch_called_with(
183+
url_for(),
184+
data=data
185+
)
186+
172187
deftest_edit(self):
173188
"""Verify the request for editing an issue."""
174189
data= {
@@ -324,7 +339,6 @@ def test_replace_labels(self):
324339

325340

326341
classTestIssueIterators(helper.UnitIteratorHelper):
327-
328342
"""Test Issue methods that return iterators."""
329343

330344
described_class=github3.issues.Issue
@@ -365,7 +379,6 @@ def test_labels(self):
365379

366380

367381
classTestLabelRequiresAuth(helper.UnitRequiresAuthenticationHelper):
368-
369382
"""Test that ensure certain methods on Label class requires auth."""
370383

371384
described_class=github3.issues.label.Label
@@ -430,7 +443,6 @@ def test_update(self):
430443

431444

432445
classTestIssueEvent(helper.UnitHelper):
433-
434446
"""Unit test for IssueEvent."""
435447

436448
described_class=github3.issues.event.IssueEvent

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp