mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #26621 -- Corrected simplify_regex()'s handling of named capture groups.
This commit is contained in:
@@ -335,6 +335,11 @@ class AdminDocViewFunctionsTests(SimpleTestCase):
|
||||
(r'^a', '/a'),
|
||||
(r'^(?P<a>\w+)/b/(?P<c>\w+)/$', '/<a>/b/<c>/'),
|
||||
(r'^(?P<a>\w+)/b/(?P<c>\w+)$', '/<a>/b/<c>'),
|
||||
(r'^(?P<a>\w+)/b/(\w+)$', '/<a>/b/<var>'),
|
||||
(r'^(?P<a>\w+)/b/((x|y)\w+)$', '/<a>/b/<var>'),
|
||||
(r'^(?P<a>(x|y))/b/(?P<c>\w+)$', '/<a>/b/<c>'),
|
||||
(r'^(?P<a>(x|y))/b/(?P<c>\w+)ab', '/<a>/b/<c>ab'),
|
||||
(r'^(?P<a>(x|y)(\(|\)))/b/(?P<c>\w+)ab', '/<a>/b/<c>ab'),
|
||||
)
|
||||
for pattern, output in tests:
|
||||
self.assertEqual(simplify_regex(pattern), output)
|
||||
|
||||
Reference in New Issue
Block a user