mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #31061 -- Ignored positional args in django.urls.resolve() when all optional named parameters are missing.
Regression in 76b993a117.
Thanks Claude Paroz for the report and Carlton Gibson for reviews.
This commit is contained in:
@@ -68,6 +68,16 @@ class SimplifiedURLTests(SimpleTestCase):
|
||||
r'^regex_optional/(?P<arg1>\d+)/(?:(?P<arg2>\d+)/)?',
|
||||
)
|
||||
|
||||
def test_re_path_with_missing_optional_parameter(self):
|
||||
match = resolve('/regex_only_optional/')
|
||||
self.assertEqual(match.url_name, 'regex_only_optional')
|
||||
self.assertEqual(match.kwargs, {})
|
||||
self.assertEqual(match.args, ())
|
||||
self.assertEqual(
|
||||
match.route,
|
||||
r'^regex_only_optional/(?:(?P<arg1>\d+)/)?',
|
||||
)
|
||||
|
||||
def test_path_lookup_with_inclusion(self):
|
||||
match = resolve('/included_urls/extra/something/')
|
||||
self.assertEqual(match.url_name, 'inner-extra')
|
||||
|
||||
Reference in New Issue
Block a user