Code

Ticket #13260: t13260-test2.diff

File t13260-test2.diff, 1.6 KB (added by stumbles, 4 years ago)

Additional tests to also cover % in keyword arguments

Line 
1Index: tests/regressiontests/urlpatterns_reverse/tests.py
2===================================================================
3--- tests/regressiontests/urlpatterns_reverse/tests.py  (revision 12936)
4+++ tests/regressiontests/urlpatterns_reverse/tests.py  (working copy)
5@@ -68,6 +68,8 @@
6     ('headlines', '/headlines/2007.5.21/', [], dict(year=2007, month=5, day=21)),
7     ('windows', r'/windows_path/C:%5CDocuments%20and%20Settings%5Cspam/', [], dict(drive_name='C', path=r'Documents and Settings\spam')),
8     ('special', r'/special_chars/+%5C$*/', [r'+\$*'], {}),
9+    ('special', r'/special_chars/some%20resource/', [], {'chars': r'some resource'}),
10+    ('special', r'/special_chars/10%25%20complete/', [], {'chars': r'10% complete'}),
11     ('special', NoReverseMatch, [''], {}),
12     ('mixed', '/john/0/', [], {'name': 'john'}),
13     ('repeats', '/repeats/a/', [], {}),
14Index: tests/regressiontests/urlpatterns_reverse/urls.py
15===================================================================
16--- tests/regressiontests/urlpatterns_reverse/urls.py   (revision 12936)
17+++ tests/regressiontests/urlpatterns_reverse/urls.py   (working copy)
18@@ -35,7 +35,7 @@
19             name="headlines"),
20     url(r'^windows_path/(?P<drive_name>[A-Z]):\\(?P<path>.+)/$', empty_view,
21             name="windows"),
22-    url(r'^special_chars/(.+)/$', empty_view, name="special"),
23+    url(r'^special_chars/(?P<chars>.+)/$', empty_view, name="special"),
24     url(r'^(?P<name>.+)/\d+/$', empty_view, name="mixed"),
25     url(r'^repeats/a{1,2}/$', empty_view, name="repeats"),
26     url(r'^repeats/a{2,4}/$', empty_view, name="repeats2"),