Adds test for native_str()

This commit is contained in:
Remi Rampin 2014-08-18 00:43:46 -04:00
parent a8a5ad41a2
commit 48584f0de7
1 changed files with 8 additions and 1 deletions

View File

@ -1,5 +1,5 @@
import os
from pip.compat import get_path_uid
from pip.compat import get_path_uid, native_str
import pytest
@ -35,3 +35,10 @@ def test_get_path_uid_symlink_without_NOFOLLOW(tmpdir, monkeypatch):
os.symlink(f, fs)
with pytest.raises(OSError):
get_path_uid(fs)
def test_to_native_str_type():
some_bytes = b"test\xE9 et approuv\xC3\xE9"
some_unicode = b"test\xE9 et approuv\xE9".decode('iso-8859-15')
assert isinstance(native_str(some_bytes, True), str)
assert isinstance(native_str(some_unicode, True), str)