diff options
| author | Jake Howard <RealOrangeOne@users.noreply.github.com> | 2024-05-29 14:48:27 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-05-29 10:48:27 -0300 |
| commit | ff308a06047cd60806d604a7cf612e5656ee2ac9 (patch) | |
| tree | f2139fbf020cbdf33bad64a3377700623c18a44f /tests/admin_views/tests.py | |
| parent | 02dab94c7b8585c7ae3854465574d768e1df75d3 (diff) | |
Fixed 35467 -- Replaced urlparse with urlsplit where appropriate.
This work should not generate any change of functionality, and
`urlsplit` is approximately 6x faster.
Most use cases of `urlparse` didn't touch the path, so they can be
converted to `urlsplit` without any issue. Most of those which do use
`.path`, simply parse the URL, mutate the querystring, then put them
back together, which is also fine (so long as urlunsplit is used).
Diffstat (limited to 'tests/admin_views/tests.py')
| -rw-r--r-- | tests/admin_views/tests.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/tests/admin_views/tests.py b/tests/admin_views/tests.py index d49e7d028b..cb6815e7a8 100644 --- a/tests/admin_views/tests.py +++ b/tests/admin_views/tests.py @@ -4,7 +4,7 @@ import re import unittest import zoneinfo from unittest import mock -from urllib.parse import parse_qsl, urljoin, urlparse +from urllib.parse import parse_qsl, urljoin, urlsplit from django import forms from django.contrib import admin @@ -357,7 +357,7 @@ class AdminViewBasicTest(AdminViewBasicTestCase): **save_option, }, ) - parsed_url = urlparse(response.url) + parsed_url = urlsplit(response.url) self.assertEqual(parsed_url.query, qsl) def test_change_query_string_persists(self): @@ -386,7 +386,7 @@ class AdminViewBasicTest(AdminViewBasicTestCase): **save_option, }, ) - parsed_url = urlparse(response.url) + parsed_url = urlsplit(response.url) self.assertEqual(parsed_url.query, qsl) def test_basic_edit_GET(self): @@ -8032,11 +8032,11 @@ class AdminKeepChangeListFiltersTests(TestCase): Assert that two URLs are equal despite the ordering of their querystring. Refs #22360. """ - parsed_url1 = urlparse(url1) + parsed_url1 = urlsplit(url1) path1 = parsed_url1.path parsed_qs1 = dict(parse_qsl(parsed_url1.query)) - parsed_url2 = urlparse(url2) + parsed_url2 = urlsplit(url2) path2 = parsed_url2.path parsed_qs2 = dict(parse_qsl(parsed_url2.query)) |
