diff options
| author | Michael Merickel <github@m.merickel.org> | 2018-11-26 17:10:21 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-11-26 17:10:21 -0600 |
| commit | 587fe72fae0efda3a860d37a1ea2449a41dab622 (patch) | |
| tree | ad938e23efd1be67821ddfb710748e746c92c420 /tests/test_request.py | |
| parent | eea97ca673a53f8aa039a78e61833f78d5d59583 (diff) | |
| parent | 81171e861d25d394c0ccb8a6139a9b89dc4f039c (diff) | |
| download | pyramid-587fe72fae0efda3a860d37a1ea2449a41dab622.tar.gz pyramid-587fe72fae0efda3a860d37a1ea2449a41dab622.tar.bz2 pyramid-587fe72fae0efda3a860d37a1ea2449a41dab622.zip | |
Merge pull request #3421 from mmerickel/drop-py2
remove py2 from the codebase
Diffstat (limited to 'tests/test_request.py')
| -rw-r--r-- | tests/test_request.py | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/tests/test_request.py b/tests/test_request.py index dcac501aa..484d86e01 100644 --- a/tests/test_request.py +++ b/tests/test_request.py @@ -1,8 +1,8 @@ import unittest from pyramid import testing -from pyramid.compat import PY2, text_, bytes_, native_ from pyramid.security import AuthenticationAPIMixin, AuthorizationAPIMixin +from pyramid.util import text_, bytes_ class TestRequest(unittest.TestCase): @@ -352,10 +352,7 @@ class TestRequest(unittest.TestCase): inp = text_( b'/\xe6\xb5\x81\xe8\xa1\x8c\xe8\xb6\x8b\xe5\x8a\xbf', 'utf-8' ) - if PY2: - body = json.dumps({'a': inp}).decode('utf-8').encode('utf-16') - else: - body = bytes(json.dumps({'a': inp}), 'utf-16') + body = bytes(json.dumps({'a': inp}), 'utf-16') request.body = body request.content_type = 'application/json; charset=utf-16' self.assertEqual(request.json_body, {'a': inp}) @@ -481,7 +478,7 @@ class Test_call_app_with_subpath_as_path_info(unittest.TestCase): self.assertEqual(request.environ['PATH_INFO'], '/hello/') def test_subpath_path_info_and_script_name_have_utf8(self): - encoded = native_(text_(b'La Pe\xc3\xb1a')) + encoded = text_(b'La Pe\xc3\xb1a') decoded = text_(bytes_(encoded), 'utf-8') request = DummyRequest( {'PATH_INFO': '/' + encoded, 'SCRIPT_NAME': '/' + encoded} |
