0
0
mirror of https://github.com/django/django.git synced 2024-12-01 15:42:04 +01:00

Refs #27804 -- Used subTest() in utils_tests/test_encoding.py.

This commit is contained in:
Jon Dufresne 2019-08-26 02:58:06 -07:00 committed by Carlton Gibson
parent 579909a13f
commit 5dac63bb84

View File

@ -121,6 +121,7 @@ class TestRFC3987IEncodingUtils(unittest.TestCase):
] ]
for iri, uri in cases: for iri, uri in cases:
with self.subTest(iri):
self.assertEqual(iri_to_uri(iri), uri) self.assertEqual(iri_to_uri(iri), uri)
# Test idempotency. # Test idempotency.
@ -144,6 +145,7 @@ class TestRFC3987IEncodingUtils(unittest.TestCase):
] ]
for uri, iri in cases: for uri, iri in cases:
with self.subTest(uri):
self.assertEqual(uri_to_iri(uri), iri) self.assertEqual(uri_to_iri(uri), iri)
# Test idempotency. # Test idempotency.
@ -165,13 +167,19 @@ class TestRFC3987IEncodingUtils(unittest.TestCase):
] ]
for uri, iri in cases: for uri, iri in cases:
with self.subTest(uri):
self.assertEqual(iri_to_uri(uri_to_iri(uri)), uri) self.assertEqual(iri_to_uri(uri_to_iri(uri)), uri)
self.assertEqual(uri_to_iri(iri_to_uri(iri)), iri) self.assertEqual(uri_to_iri(iri_to_uri(iri)), iri)
def test_escape_uri_path(self): def test_escape_uri_path(self):
self.assertEqual( cases = [
escape_uri_path('/;some/=awful/?path/:with/@lots/&of/+awful/chars'), (
'/%3Bsome/%3Dawful/%3Fpath/:with/@lots/&of/+awful/chars' '/;some/=awful/?path/:with/@lots/&of/+awful/chars',
) '/%3Bsome/%3Dawful/%3Fpath/:with/@lots/&of/+awful/chars',
self.assertEqual(escape_uri_path('/foo#bar'), '/foo%23bar') ),
self.assertEqual(escape_uri_path('/foo?bar'), '/foo%3Fbar') ('/foo#bar', '/foo%23bar'),
('/foo?bar', '/foo%3Fbar'),
]
for uri, expected in cases:
with self.subTest(uri):
self.assertEqual(escape_uri_path(uri), expected)