summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMichael Merickel <michael@merickel.org>2018-11-12 23:16:09 -0600
committerMichael Merickel <michael@merickel.org>2018-11-12 23:16:09 -0600
commitb1a257bacc1c4ac2c1401ed02c51d9c6c03685d2 (patch)
treea3024d0d24f192d1dd8c24eab6e9ec4b39169489 /tests
parent6b0e4625da2c53a1e3fdb4857fc7c6ba6ce562cf (diff)
downloadpyramid-b1a257bacc1c4ac2c1401ed02c51d9c6c03685d2.tar.gz
pyramid-b1a257bacc1c4ac2c1401ed02c51d9c6c03685d2.tar.bz2
pyramid-b1a257bacc1c4ac2c1401ed02c51d9c6c03685d2.zip
get rid of type aliases
Diffstat (limited to 'tests')
-rw-r--r--tests/test_authentication.py12
-rw-r--r--tests/test_config/test_factories.py2
-rw-r--r--tests/test_config/test_views.py13
-rw-r--r--tests/test_httpexceptions.py4
-rw-r--r--tests/test_traversal.py15
-rw-r--r--tests/test_view.py3
6 files changed, 9 insertions, 40 deletions
diff --git a/tests/test_authentication.py b/tests/test_authentication.py
index fc3e60587..87b7da5a8 100644
--- a/tests/test_authentication.py
+++ b/tests/test_authentication.py
@@ -1272,18 +1272,6 @@ class TestAuthTktCookieHelper(unittest.TestCase):
self.assertEqual(val['userid'], '1')
self.assertEqual(val['user_data'], 'userid_type:int')
- def test_remember_long_userid(self):
- from pyramid.compat import long
-
- helper = self._makeOne('secret')
- request = self._makeRequest()
- result = helper.remember(request, long(1))
- values = self._parseHeaders(result)
- self.assertEqual(len(result), 3)
- val = self._cookieValue(values[0])
- self.assertEqual(val['userid'], '1')
- self.assertEqual(val['user_data'], 'userid_type:int')
-
def test_remember_unicode_userid(self):
import base64
diff --git a/tests/test_config/test_factories.py b/tests/test_config/test_factories.py
index cca528275..bbc38b6cd 100644
--- a/tests/test_config/test_factories.py
+++ b/tests/test_config/test_factories.py
@@ -160,7 +160,7 @@ class TestFactoriesMixin(unittest.TestCase):
config = self._makeOne(autocommit=True)
self.assertRaises(AttributeError, config.add_request_method)
- def test_add_request_method_with_text_type_name(self):
+ def test_add_request_method_with_text_name(self):
from pyramid.exceptions import ConfigurationError
config = self._makeOne(autocommit=True)
diff --git a/tests/test_config/test_views.py b/tests/test_config/test_views.py
index b72b9b36a..aa5b67050 100644
--- a/tests/test_config/test_views.py
+++ b/tests/test_config/test_views.py
@@ -2795,15 +2795,6 @@ class TestViewsConfigurationMixin(unittest.TestCase):
request = self._makeRequest(config)
self.assertRaises(PredicateMismatch, wrapper, context, request)
- # Since Python 3 has to be all cool and fancy and different...
- def _assertBody(self, response, value):
- from pyramid.compat import text_type
-
- if isinstance(value, text_type): # pragma: no cover
- self.assertEqual(response.text, value)
- else: # pragma: no cover
- self.assertEqual(response.body, value)
-
def test_add_notfound_view_with_renderer(self):
from zope.interface import implementedBy
from pyramid.interfaces import IRequest
@@ -2820,7 +2811,7 @@ class TestViewsConfigurationMixin(unittest.TestCase):
request_iface=IRequest,
)
result = view(None, request)
- self._assertBody(result, '{}')
+ self.assertEqual(result.text, '{}')
def test_add_forbidden_view_with_renderer(self):
from zope.interface import implementedBy
@@ -2838,7 +2829,7 @@ class TestViewsConfigurationMixin(unittest.TestCase):
request_iface=IRequest,
)
result = view(None, request)
- self._assertBody(result, '{}')
+ self.assertEqual(result.text, '{}')
def test_set_view_mapper(self):
from pyramid.interfaces import IViewMapperFactory
diff --git a/tests/test_httpexceptions.py b/tests/test_httpexceptions.py
index 4c13e096d..195496e2e 100644
--- a/tests/test_httpexceptions.py
+++ b/tests/test_httpexceptions.py
@@ -1,6 +1,6 @@
import unittest
-from pyramid.compat import bytes_, string_types, text_
+from pyramid.compat import bytes_, text_
class Test_exception_response(unittest.TestCase):
@@ -406,7 +406,7 @@ class TestHTTPException(unittest.TestCase):
def test_allow_detail_non_str(self):
exc = self._makeOne(detail={'error': 'This is a test'})
- self.assertIsInstance(exc.__str__(), string_types)
+ self.assertIsInstance(exc.__str__(), str)
class TestRenderAllExceptionsWithoutArguments(unittest.TestCase):
diff --git a/tests/test_traversal.py b/tests/test_traversal.py
index b517fa646..ed5e0031e 100644
--- a/tests/test_traversal.py
+++ b/tests/test_traversal.py
@@ -3,7 +3,7 @@ import unittest
from pyramid.testing import cleanUp
-from pyramid.compat import text_, native_, text_type, url_quote
+from pyramid.compat import text_, native_, url_quote
class TraversalPathTests(unittest.TestCase):
@@ -71,8 +71,8 @@ class TraversalPathInfoTests(unittest.TestCase):
def test_segments_are_unicode(self):
result = self._callFUT('/foo/bar')
- self.assertEqual(type(result[0]), text_type)
- self.assertEqual(type(result[1]), text_type)
+ self.assertEqual(type(result[0]), str)
+ self.assertEqual(type(result[1]), str)
def test_same_value_returned_if_cached(self):
result1 = self._callFUT('/foo/bar')
@@ -870,15 +870,6 @@ class QuotePathSegmentTests(unittest.TestCase):
result = self._callFUT(s)
self.assertEqual(result, '12345')
- def test_long(self):
- from pyramid.compat import long
- import sys
-
- s = long(sys.maxsize + 1)
- result = self._callFUT(s)
- expected = str(s)
- self.assertEqual(result, expected)
-
def test_other(self):
class Foo(object):
def __str__(self):
diff --git a/tests/test_view.py b/tests/test_view.py
index f82480169..de40df1d5 100644
--- a/tests/test_view.py
+++ b/tests/test_view.py
@@ -417,12 +417,11 @@ class RenderViewToIterableTests(BaseTest, unittest.TestCase):
from pyramid.request import Request
from pyramid.config import Configurator
from pyramid.view import render_view
- from webob.compat import text_type
config = Configurator(settings={})
def view(request):
- request.response.text = text_type('<body></body>')
+ request.response.text = '<body></body>'
return request.response
config.add_view(name='test', view=view)