summaryrefslogtreecommitdiff
path: root/tests/forms_tests
diff options
context:
space:
mode:
authorNatalia <124304+nessita@users.noreply.github.com>2026-03-03 12:31:04 -0300
committernessita <124304+nessita@users.noreply.github.com>2026-03-03 17:40:38 -0300
commit4b6c998301fedec279ec97b6547e67c3e88b7ff0 (patch)
tree94f9f394582b292a8ea69544c276ca744fce762c /tests/forms_tests
parent5b939808220fa879942303f4318276668d11b4d9 (diff)
Fixed #36923 -- Added tests for non-hierarchical URI schemes in URLField.to_python().
Follow up to 951ffb3832cd83ba672c1e3deae2bda128eb9cca.
Diffstat (limited to 'tests/forms_tests')
-rw-r--r--tests/forms_tests/field_tests/test_urlfield.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/forms_tests/field_tests/test_urlfield.py b/tests/forms_tests/field_tests/test_urlfield.py
index 87d3489687..d27714107d 100644
--- a/tests/forms_tests/field_tests/test_urlfield.py
+++ b/tests/forms_tests/field_tests/test_urlfield.py
@@ -209,6 +209,20 @@ class URLFieldTest(FormFieldAssertionsMixin, SimpleTestCase):
with self.subTest(value=value):
self.assertEqual(f.clean(value), expected)
+ def test_urlfield_non_hierarchical_schemes_unchanged_in_to_python(self):
+ f = URLField()
+ tests = [
+ "mailto:test@example.com",
+ "mailto:test@example.com?subject=Hello",
+ "tel:+1-800-555-0100",
+ "tel:555-0100",
+ "urn:isbn:0-486-27557-4",
+ "urn:ietf:rfc:2648",
+ ]
+ for value in tests:
+ with self.subTest(value=value):
+ self.assertEqual(f.to_python(value), value)
+
def test_custom_validator_longer_max_length(self):
class CustomLongURLValidator(URLValidator):