From 6b0e4625da2c53a1e3fdb4857fc7c6ba6ce562cf Mon Sep 17 00:00:00 2001 From: Michael Merickel Date: Wed, 31 Oct 2018 01:36:26 -0500 Subject: initial work to remove py2 from the codebase --- tests/test_util.py | 27 +++++---------------------- 1 file changed, 5 insertions(+), 22 deletions(-) (limited to 'tests/test_util.py') diff --git a/tests/test_util.py b/tests/test_util.py index a36655f6f..8af5fe557 100644 --- a/tests/test_util.py +++ b/tests/test_util.py @@ -1,5 +1,5 @@ import unittest -from pyramid.compat import PY2, text_, bytes_ +from pyramid.compat import text_, bytes_ class Test_InstancePropertyHelper(unittest.TestCase): @@ -170,14 +170,10 @@ class Test_InstancePropertyHelper(unittest.TestCase): self.assertEqual(2, foo.y) def test_make_property_unicode(self): - from pyramid.compat import text_ from pyramid.exceptions import ConfigurationError cls = self._getTargetClass() - if PY2: - name = text_(b'La Pe\xc3\xb1a', 'utf-8') - else: - name = b'La Pe\xc3\xb1a' + name = b'La Pe\xc3\xb1a' def make_bad_name(): cls.make_property(lambda x: 1, name=name, reify=True) @@ -498,10 +494,7 @@ class Test_object_description(unittest.TestCase): self.assertEqual(self._callFUT(('a', 'b')), "('a', 'b')") def test_set(self): - if PY2: - self.assertEqual(self._callFUT(set(['a'])), "set(['a'])") - else: - self.assertEqual(self._callFUT(set(['a'])), "{'a'}") + self.assertEqual(self._callFUT(set(['a'])), "{'a'}") def test_list(self): self.assertEqual(self._callFUT(['a']), "['a']") @@ -841,26 +834,16 @@ class TestSentinel(unittest.TestCase): class TestCallableName(unittest.TestCase): def test_valid_ascii(self): from pyramid.util import get_callable_name - from pyramid.compat import text_ - - if PY2: - name = text_(b'hello world', 'utf-8') - else: - name = b'hello world' + name = b'hello world' self.assertEqual(get_callable_name(name), 'hello world') def test_invalid_ascii(self): from pyramid.util import get_callable_name - from pyramid.compat import text_ from pyramid.exceptions import ConfigurationError def get_bad_name(): - if PY2: - name = text_(b'La Pe\xc3\xb1a', 'utf-8') - else: - name = b'La Pe\xc3\xb1a' - + name = b'La Pe\xc3\xb1a' get_callable_name(name) self.assertRaises(ConfigurationError, get_bad_name) -- cgit v1.2.3