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