mirror of
				https://github.com/django/django.git
				synced 2025-10-31 09:41:08 +00:00 
			
		
		
		
	Refs #27804 -- Used subTest() in utils_tests/test_encoding.py.
This commit is contained in:
		
				
					committed by
					
						 Carlton Gibson
						Carlton Gibson
					
				
			
			
				
	
			
			
			
						parent
						
							579909a13f
						
					
				
				
					commit
					5dac63bb84
				
			| @@ -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) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user