Ticket #13154: django-smarter-reverse-tests.patch
File django-smarter-reverse-tests.patch, 2.7 KB (added by , 15 years ago) |
---|
-
tests/regressiontests/urlpatterns_reverse/views.py
6 6 7 7 def absolute_kwargs_view(request, arg1=1, arg2=2): 8 8 pass 9 10 def defaults_view(request, arg1, arg2): 11 pass -
tests/regressiontests/urlpatterns_reverse/tests.py
102 102 ('kwargs_view', '/arg_view/10/', [], {'arg1':10}), 103 103 ('regressiontests.urlpatterns_reverse.views.absolute_kwargs_view', '/absolute_arg_view/', [], {}), 104 104 ('regressiontests.urlpatterns_reverse.views.absolute_kwargs_view', '/absolute_arg_view/10/', [], {'arg1':10}), 105 ('non_path_include', '/includes/non_path_include/', [], {}) 105 ('non_path_include', '/includes/non_path_include/', [], {}), 106 106 107 # Tests for #13154 108 ('defaults', '/defaults_view1/3/', [], {'arg1': 3, 'arg2': 1}), 109 ('defaults', '/defaults_view2/3/', [], {'arg1': 3, 'arg2': 2}), 110 ('defaults', NoReverseMatch, [], {'arg1': 3, 'arg2': 3}), 111 ('defaults', NoReverseMatch, [], {'arg2': 1}), 107 112 ) 108 113 109 114 class URLPatternReverse(TestCase): -
tests/regressiontests/urlpatterns_reverse/urls.py
19 19 url(r'^people/(?:name/)', empty_view, name="people2"), 20 20 url(r'^people/(?:name/(\w+)/)?', empty_view, name="people2a"), 21 21 url(r'^optional/(?P<name>.*)/(?:.+/)?', empty_view, name="optional"), 22 url(r'^hardcoded/$', 'hardcoded/',empty_view, name="hardcoded"),22 url(r'^hardcoded/$', empty_view, name="hardcoded"), 23 23 url(r'^hardcoded/doc\.pdf$', empty_view, name="hardcoded2"), 24 24 url(r'^people/(?P<state>\w\w)/(?P<name>\w+)/$', empty_view, name="people3"), 25 25 url(r'^people/(?P<state>\w\w)/(?P<name>\d)/$', empty_view, name="people4"), … … 55 55 url(r'arg_view/(?P<arg1>\d+)/$', 'kwargs_view'), 56 56 url(r'absolute_arg_view/(?P<arg1>\d+)/$', absolute_kwargs_view), 57 57 url(r'absolute_arg_view/$', absolute_kwargs_view), 58 58 59 # Tests for #13154. Mixed syntax to test both ways of defining URLs. 60 url(r'defaults_view1/(?P<arg1>\d+)/', 'defaults_view', {'arg2': 1}, name='defaults'), 61 (r'defaults_view2/(?P<arg1>\d+)/', 'defaults_view', {'arg2': 2}, 'defaults'), 62 59 63 url('^includes/', include(other_patterns)), 60 64 61 65 )