summaryrefslogtreecommitdiff
path: root/tests/test_util.py
diff options
context:
space:
mode:
authorMichael Merickel <michael@merickel.org>2018-11-14 22:15:57 -0600
committerMichael Merickel <michael@merickel.org>2018-11-14 22:15:57 -0600
commit2f8ede09e52162e475aececf587b21e96a2b1a79 (patch)
treeb14ed0c012654af2b2a19d4043895816cb7021af /tests/test_util.py
parent78dcc6dff88829831ead187804ac9233eafab52e (diff)
downloadpyramid-2f8ede09e52162e475aececf587b21e96a2b1a79.tar.gz
pyramid-2f8ede09e52162e475aececf587b21e96a2b1a79.tar.bz2
pyramid-2f8ede09e52162e475aececf587b21e96a2b1a79.zip
move text_, bytes_ and ascii_ to pyramid.util and remove native_
Diffstat (limited to 'tests/test_util.py')
-rw-r--r--tests/test_util.py23
1 files changed, 14 insertions, 9 deletions
diff --git a/tests/test_util.py b/tests/test_util.py
index d6d1d1502..0f313955b 100644
--- a/tests/test_util.py
+++ b/tests/test_util.py
@@ -1,6 +1,6 @@
import sys
import unittest
-from pyramid.compat import text_, bytes_
+from pyramid.util import text_, bytes_
class Test_InstancePropertyHelper(unittest.TestCase):
@@ -833,21 +833,26 @@ class TestSentinel(unittest.TestCase):
class TestCallableName(unittest.TestCase):
- def test_valid_ascii(self):
+ def _callFUT(self, val):
from pyramid.util import get_callable_name
+ return get_callable_name(val)
+
+ def test_valid_ascii_bytes(self):
name = b'hello world'
- self.assertEqual(get_callable_name(name), 'hello world')
+ self.assertEqual(self._callFUT(name), 'hello world')
- def test_invalid_ascii(self):
- from pyramid.util import get_callable_name
+ def test_valid_ascii_string(self):
from pyramid.exceptions import ConfigurationError
- def get_bad_name():
- name = b'La Pe\xc3\xb1a'
- get_callable_name(name)
+ name = b'La Pe\xc3\xb1a'.decode('utf-8')
+ self.assertRaises(ConfigurationError, self._callFUT, name)
- self.assertRaises(ConfigurationError, get_bad_name)
+ def test_invalid_ascii(self):
+ from pyramid.exceptions import ConfigurationError
+
+ name = b'La Pe\xc3\xb1a'
+ self.assertRaises(ConfigurationError, self._callFUT, name)
class Test_hide_attrs(unittest.TestCase):