summaryrefslogtreecommitdiff
path: root/tests/httpwrappers
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2016-12-01 11:38:01 +0100
committerClaude Paroz <claude@2xlibre.net>2017-01-18 16:21:28 +0100
commitc716fe87821df00f9f03ecc761c914d1682591a2 (patch)
tree0436706cdb190acbc76fb5fcf6d66f16e09fafa3 /tests/httpwrappers
parente63d98b7beb16d1410168a2315cbe04c43c9c80d (diff)
downloaddjango-c716fe87821df00f9f03ecc761c914d1682591a2.tar.gz
Refs #23919 -- Removed six.PY2/PY3 usage
Thanks Tim Graham for the review.
Diffstat (limited to 'tests/httpwrappers')
-rw-r--r--tests/httpwrappers/tests.py34
1 files changed, 0 insertions, 34 deletions
diff --git a/tests/httpwrappers/tests.py b/tests/httpwrappers/tests.py
index d9885ea40c..9042f8ed6e 100644
--- a/tests/httpwrappers/tests.py
+++ b/tests/httpwrappers/tests.py
@@ -55,8 +55,6 @@ class QueryDictTests(SimpleTestCase):
def test_immutable_basic_operations(self):
q = QueryDict()
self.assertEqual(q.getlist('foo'), [])
- if six.PY2:
- self.assertIs(q.has_key('foo'), False)
self.assertNotIn('foo', q)
self.assertEqual(list(six.iteritems(q)), [])
self.assertEqual(list(six.iterlists(q)), [])
@@ -85,11 +83,7 @@ class QueryDictTests(SimpleTestCase):
with self.assertRaises(AttributeError):
q.appendlist('foo', ['bar'])
- if six.PY2:
- self.assertTrue(q.has_key('foo'))
self.assertIn('foo', q)
- if six.PY2:
- self.assertFalse(q.has_key('bar'))
self.assertNotIn('bar', q)
self.assertEqual(list(six.iteritems(q)), [('foo', 'bar')])
@@ -150,8 +144,6 @@ class QueryDictTests(SimpleTestCase):
q.appendlist('foo', 'another')
self.assertEqual(q.getlist('foo'), ['bar', 'baz', 'another'])
self.assertEqual(q['foo'], 'another')
- if six.PY2:
- self.assertTrue(q.has_key('foo'))
self.assertIn('foo', q)
self.assertListEqual(sorted(six.iteritems(q)),
@@ -199,11 +191,7 @@ class QueryDictTests(SimpleTestCase):
with self.assertRaises(AttributeError):
q.appendlist('foo', ['bar'])
- if six.PY2:
- self.assertIs(q.has_key('vote'), True)
self.assertIn('vote', q)
- if six.PY2:
- self.assertIs(q.has_key('foo'), False)
self.assertNotIn('foo', q)
self.assertEqual(list(six.iteritems(q)), [('vote', 'no')])
self.assertEqual(list(six.iterlists(q)), [('vote', ['yes', 'no'])])
@@ -224,19 +212,6 @@ class QueryDictTests(SimpleTestCase):
with self.assertRaises(AttributeError):
q.__delitem__('vote')
- if six.PY2:
- def test_invalid_input_encoding(self):
- """
- QueryDicts must be able to handle invalid input encoding (in this
- case, bad UTF-8 encoding), falling back to ISO-8859-1 decoding.
-
- This test doesn't apply under Python 3 because the URL is a string
- and not a bytestring.
- """
- q = QueryDict(str(b'foo=bar&foo=\xff'))
- self.assertEqual(q['foo'], '\xff')
- self.assertEqual(q.getlist('foo'), ['bar', '\xff'])
-
def test_pickle(self):
q = QueryDict()
q1 = pickle.loads(pickle.dumps(q, 2))
@@ -807,15 +782,6 @@ class CookieTests(unittest.TestCase):
c.load({'name': 'val'})
self.assertEqual(c['name'].value, 'val')
- @unittest.skipUnless(six.PY2, "PY3 throws an exception on invalid cookie keys.")
- def test_bad_cookie(self):
- """
- Regression test for #18403
- """
- r = HttpResponse()
- r.set_cookie("a:.b/", 1)
- self.assertEqual(len(r.cookies.bad_cookies), 1)
-
def test_pickle(self):
rawdata = 'Customer="WILE_E_COYOTE"; Path=/acme; Version=1'
expected_output = 'Set-Cookie: %s' % rawdata