@@ -62,24 +62,24 @@ def test_native_str(self):
62
62
for s in inputs :
63
63
self .assertEqual (native_str (s ), builtin_str (s ))
64
64
self .assertTrue (isinstance (native_str (s ), builtin_str ))
65
-
66
- def test_native (self ):
65
+
66
+ def test_native (self ):
67
67
a = int (10 ** 20 ) # long int
68
68
b = native (a )
69
69
self .assertEqual (a , b )
70
70
if PY2 :
71
71
self .assertEqual (type (b ), long )
72
72
else :
73
73
self .assertEqual (type (b ), int )
74
-
74
+
75
75
c = bytes (b'ABC' )
76
76
d = native (c )
77
77
self .assertEqual (c , d )
78
78
if PY2 :
79
79
self .assertEqual (type (d ), type (b'Py2 byte-string' ))
80
80
else :
81
81
self .assertEqual (type (d ), bytes )
82
-
82
+
83
83
s = str (u'ABC' )
84
84
t = native (s )
85
85
self .assertEqual (s , t )
@@ -151,7 +151,7 @@ def test_raise_from_None(self):
151
151
except ValueError as e :
152
152
self .assertTrue (isinstance (e .__context__ , TypeError ))
153
153
self .assertIsNone (e .__cause__ )
154
-
154
+
155
155
@skip26
156
156
def test_as_native_str (self ):
157
157
"""
@@ -161,9 +161,9 @@ class MyClass(object):
161
161
@as_native_str ()
162
162
def __repr__ (self ):
163
163
return u'abc'
164
-
164
+
165
165
obj = MyClass ()
166
-
166
+
167
167
self .assertEqual (repr (obj ), 'abc' )
168
168
if PY2 :
169
169
self .assertEqual (repr (obj ), b'abc' )
@@ -186,6 +186,9 @@ def test_ensure_new_type(self):
186
186
self .assertEqual (ensure_new_type (i ), i2 )
187
187
self .assertEqual (type (ensure_new_type (i )), int )
188
188
189
+ l = []
190
+ self .assertIs (ensure_new_type (l ), l )
191
+
189
192
def test_bytes_to_native_str (self ):
190
193
"""
191
194
Test for issue #47
@@ -215,7 +218,7 @@ class DatabaseError(Exception):
215
218
216
219
# Python 2 and 3:
217
220
from future .utils import raise_from
218
-
221
+
219
222
class FileDatabase :
220
223
def __init__ (self , filename ):
221
224
try :
@@ -228,7 +231,7 @@ def __init__(self, filename):
228
231
fd = FileDatabase ('non_existent_file.txt' )
229
232
except Exception as e :
230
233
assert isinstance (e .__cause__ , IOError ) # FileNotFoundError on
231
- # Py3.3+ inherits from IOError
234
+ # Py3.3+ inherits from IOError
232
235
233
236
def testCauseSyntax (self ):
234
237
try :
0 commit comments