summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBert JW Regeer <bertjw@regeer.org>2018-11-14 23:25:51 -0700
committerBert JW Regeer <bertjw@regeer.org>2020-11-28 12:19:50 -0800
commit0c5700be0f8747ed138ebd1cb3c8bcaf4dd3d64c (patch)
tree467468b24f3b01fc970268fcda815d4a3ec1e937 /tests
parente0452f46429da71a65a84b44bd6cc7cf0cb6dd84 (diff)
downloadwebob-0c5700be0f8747ed138ebd1cb3c8bcaf4dd3d64c.tar.gz
Goodbye compat.PY2 lines
Diffstat (limited to 'tests')
-rw-r--r--tests/performance_test.py6
-rw-r--r--tests/test_cookies.py26
-rw-r--r--tests/test_misc.py14
-rw-r--r--tests/test_multidict.py7
4 files changed, 4 insertions, 49 deletions
diff --git a/tests/performance_test.py b/tests/performance_test.py
index 4c4917f..9b4397b 100644
--- a/tests/performance_test.py
+++ b/tests/performance_test.py
@@ -1,6 +1,5 @@
#!/usr/bin/env python
from webob.response import Response
-from webob.compat import PY2
def make_middleware(app):
@@ -43,10 +42,7 @@ if __name__ == "__main__":
print("Hit ^C to end")
try:
while 1:
- if PY2:
- raw_input() # noqa: F821
- else:
- input()
+ input()
finally:
os.kill(proc.pid, signal.SIGKILL)
else:
diff --git a/tests/test_cookies.py b/tests/test_cookies.py
index 578bfb8..6f62eb0 100644
--- a/tests/test_cookies.py
+++ b/tests/test_cookies.py
@@ -6,9 +6,6 @@ from webob import cookies
from webob.compat import text_
from webob.compat import native_
-py2only = pytest.mark.skipif("sys.version_info >= (3, 0)")
-py3only = pytest.mark.skipif("sys.version_info < (3, 0)")
-
def setup_module(module):
cookies._should_raise = True
@@ -407,40 +404,17 @@ class TestRequestCookies(object):
inst = self._makeOne(environ)
assert sorted(list(inst.items())) == [("a", "1"), ("b", val), ("c", "3")]
- @py2only
- def test_iterkeys(self):
- environ = {"HTTP_COOKIE": 'a=1; b="La Pe\\303\\261a"; c=3'}
- inst = self._makeOne(environ)
- assert sorted(list(inst.iterkeys())) == ["a", "b", "c"]
-
- @py3only
def test_iterkeys_py3(self):
environ = {"HTTP_COOKIE": b'a=1; b="La Pe\\303\\261a"; c=3'.decode("utf-8")}
inst = self._makeOne(environ)
assert sorted(list(inst.keys())) == ["a", "b", "c"]
- @py2only
- def test_itervalues(self):
- val = text_(b"La Pe\xc3\xb1a", "utf-8")
- environ = {"HTTP_COOKIE": 'a=1; b="La Pe\\303\\261a"; c=3'}
- inst = self._makeOne(environ)
- sorted(list(inst.itervalues())) == ["1", "3", val]
-
- @py3only
def test_itervalues_py3(self):
val = text_(b"La Pe\xc3\xb1a", "utf-8")
environ = {"HTTP_COOKIE": b'a=1; b="La Pe\\303\\261a"; c=3'.decode("utf-8")}
inst = self._makeOne(environ)
sorted(list(inst.values())) == ["1", "3", val]
- @py2only
- def test_iteritems(self):
- val = text_(b"La Pe\xc3\xb1a", "utf-8")
- environ = {"HTTP_COOKIE": 'a=1; b="La Pe\\303\\261a"; c=3'}
- inst = self._makeOne(environ)
- assert sorted(list(inst.iteritems())) == [("a", "1"), ("b", val), ("c", "3")]
-
- @py3only
def test_iteritems_py3(self):
val = text_(b"La Pe\xc3\xb1a", "utf-8")
environ = {"HTTP_COOKIE": b'a=1; b="La Pe\\303\\261a"; c=3'.decode("utf-8")}
diff --git a/tests/test_misc.py b/tests/test_misc.py
index 1b6c629..42d0479 100644
--- a/tests/test_misc.py
+++ b/tests/test_misc.py
@@ -1,10 +1,6 @@
import pytest
-
-from webob.util import html_escape
from webob.compat import text_
-
-py2only = pytest.mark.skipif("sys.version_info >= (3, 0)")
-py3only = pytest.mark.skipif("sys.version_info < (3, 0)")
+from webob.util import html_escape
class t_esc_HTML(object):
@@ -43,8 +39,7 @@ class t_esc_SuperMoose(object):
("&egrave;", "&amp;egrave;"),
# The apostrophe is *not* escaped, which some might consider to be
# a serious bug (see, e.g. http://www.cvedetails.com/cve/CVE-2010-2480/)
- pytest.param("'", "'", marks=py2only),
- pytest.param("'", "&#x27;", marks=py3only),
+ pytest.param("'", "&#x27;"),
(text_("the majestic m\xf8ose"), "the majestic m&#248;ose"),
# 8-bit strings are passed through
(text_("\xe9"), "&#233;"),
@@ -59,10 +54,7 @@ class t_esc_SuperMoose(object):
(t_esc_SuperMoose(), "m&#248;ose"),
(t_esc_Unicode(), "&#233;"),
(t_esc_UnsafeAttrs(), "&lt;UnsafeAttrs&gt;"),
- pytest.param(Exception("expected a '<'."), "expected a '&lt;'.", marks=py2only),
- pytest.param(
- Exception("expected a '<'."), "expected a &#x27;&lt;&#x27;.", marks=py3only
- ),
+ pytest.param(Exception("expected a '<'."), "expected a &#x27;&lt;&#x27;."),
],
)
def test_html_escape(input, expected):
diff --git a/tests/test_multidict.py b/tests/test_multidict.py
index 5c9fa85..f040d4a 100644
--- a/tests/test_multidict.py
+++ b/tests/test_multidict.py
@@ -41,11 +41,8 @@ class BaseDictTests(object):
def test_dict_api(self):
self.assertTrue("a" in self.d.mixed())
self.assertTrue("a" in self.d.keys())
- self.assertTrue("a" in self.d.iterkeys())
self.assertTrue(("b", "1") in self.d.items())
- self.assertTrue(("b", "1") in self.d.iteritems())
self.assertTrue("1" in self.d.values())
- self.assertTrue("1" in self.d.itervalues())
self.assertEqual(len(self.d), 4)
def test_set_del_item(self):
@@ -502,10 +499,6 @@ class NoVarsTestCase(unittest.TestCase):
d = self._get_instance()
self.assertEqual(list(d.keys()), [])
- def test_iterkeys(self):
- d = self._get_instance()
- self.assertEqual(list(d.iterkeys()), [])
-
class DummyField(object):
def __init__(self, name, value, filename=None):