Skip to content

Commit

Permalink
Add a test for issue #47: "Contradictory terminology about native types"
Browse files Browse the repository at this point in the history
  • Loading branch information
edschofield committed May 5, 2014
1 parent 6c74962 commit 27ee197
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions future/tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
import sys
from future.builtins import *
from future.utils import (old_div, istext, isbytes, native, PY2, PY3,
native_str, raise_, as_native_str, ensure_new_type)

native_str, raise_, as_native_str, ensure_new_type,
bytes_to_native_str)

from numbers import Integral
from future.tests.base import unittest, skip26
Expand Down Expand Up @@ -175,6 +175,16 @@ def test_ensure_new_type(self):
self.assertEqual(ensure_new_type(i), i2)
self.assertEqual(type(ensure_new_type(i)), int)

def test_bytes_to_native_str(self):
"""
Test for issue #47
"""
b = bytes(b'abc')
s = bytes_to_native_str(b)
self.assertEqual(b, s)
self.assertTrue(isinstance(s, native_str))
self.assertEqual(type(s), native_str)


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

0 comments on commit 27ee197

Please sign in to comment.