Skip to content

Commit 4b6c998

Browse files
committed
Fixed #36923 -- Added tests for non-hierarchical URI schemes in URLField.to_python().
Follow up to 951ffb3.
1 parent 5b93980 commit 4b6c998

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

tests/forms_tests/field_tests/test_urlfield.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,20 @@ def test_urlfield_assume_scheme_when_colons(self):
209209
with self.subTest(value=value):
210210
self.assertEqual(f.clean(value), expected)
211211

212+
def test_urlfield_non_hierarchical_schemes_unchanged_in_to_python(self):
213+
f = URLField()
214+
tests = [
215+
"mailto:test@example.com",
216+
"mailto:test@example.com?subject=Hello",
217+
"tel:+1-800-555-0100",
218+
"tel:555-0100",
219+
"urn:isbn:0-486-27557-4",
220+
"urn:ietf:rfc:2648",
221+
]
222+
for value in tests:
223+
with self.subTest(value=value):
224+
self.assertEqual(f.to_python(value), value)
225+
212226
def test_custom_validator_longer_max_length(self):
213227

214228
class CustomLongURLValidator(URLValidator):

0 commit comments

Comments
 (0)