Skip to content

Commit 27ee197

Browse files
committed
Add a test for issue #47: "Contradictory terminology about native types"
1 parent 6c74962 commit 27ee197

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

future/tests/test_utils.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
import sys
88
from future.builtins import *
99
from future.utils import (old_div, istext, isbytes, native, PY2, PY3,
10-
native_str, raise_, as_native_str, ensure_new_type)
11-
10+
native_str, raise_, as_native_str, ensure_new_type,
11+
bytes_to_native_str)
1212

1313
from numbers import Integral
1414
from future.tests.base import unittest, skip26
@@ -175,6 +175,16 @@ def test_ensure_new_type(self):
175175
self.assertEqual(ensure_new_type(i), i2)
176176
self.assertEqual(type(ensure_new_type(i)), int)
177177

178+
def test_bytes_to_native_str(self):
179+
"""
180+
Test for issue #47
181+
"""
182+
b = bytes(b'abc')
183+
s = bytes_to_native_str(b)
184+
self.assertEqual(b, s)
185+
self.assertTrue(isinstance(s, native_str))
186+
self.assertEqual(type(s), native_str)
187+
178188

179189
if __name__ == '__main__':
180190
unittest.main()

0 commit comments

Comments
 (0)