Skip to content

Commit 6e8f844

Browse files
committed
Don't encode repr_string under Python 3.
1 parent 8dc2aa2 commit 6e8f844

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

github2/core.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
1+
import sys
12
import time
23

34
from datetime import datetime
45

6+
#: Running under Python 3
7+
PY3K = sys.version_info[0] == 3 and True or False
8+
9+
510
GITHUB_TIMEZONE = "-0700"
611
GITHUB_DATE_FORMAT = "%Y/%m/%d %H:%M:%S"
712
#2009-03-21T18:01:48-07:00
@@ -294,4 +299,6 @@ def repr_string(string):
294299
"""
295300
if len(string) > 20:
296301
string = string[:17] + '...'
297-
return string.encode('utf-8')
302+
if not PY3K:
303+
string.decode('utf-8')
304+
return string

tests/test_unit.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import _setup
44

55
import datetime
6-
import sys
76
import unittest
87

98
from nose.tools import (assert_equals, assert_true)
@@ -21,8 +20,6 @@ class ReprTests(unittest.TestCase):
2120
def test_issue(self):
2221
"""Issues can have non-ASCII characters in the title."""
2322
title = 'abcdé'
24-
if sys.version_info[0] == 2:
25-
title = title.decode("utf-8")
2623
i = Issue(title=title)
2724
assert_equals(str, type(repr(i)))
2825

0 commit comments

Comments
 (0)