diff options
| author | Tim Graham <timograham@gmail.com> | 2018-12-07 17:52:28 -0500 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2018-12-31 10:47:32 -0500 |
| commit | 043bd709425149b8eff3fb821cba5c23aaebd0df (patch) | |
| tree | 7624be405a6a6e5a041e2852251ef76e9d28fa7d /tests/check_framework/urls | |
| parent | 1136d57f01ce3e3efab44163ccd7b3b34ec4207f (diff) | |
Updated test URL patterns to use path() and re_path().
Diffstat (limited to 'tests/check_framework/urls')
| -rw-r--r-- | tests/check_framework/urls/beginning_with_slash.py | 5 | ||||
| -rw-r--r-- | tests/check_framework/urls/include_with_dollar.py | 4 | ||||
| -rw-r--r-- | tests/check_framework/urls/name_with_colon.py | 4 | ||||
| -rw-r--r-- | tests/check_framework/urls/no_warnings.py | 8 | ||||
| -rw-r--r-- | tests/check_framework/urls/no_warnings_i18n.py | 4 | ||||
| -rw-r--r-- | tests/check_framework/urls/non_unique_namespaces.py | 14 | ||||
| -rw-r--r-- | tests/check_framework/urls/unique_namespaces.py | 18 | ||||
| -rw-r--r-- | tests/check_framework/urls/warning_in_include.py | 6 |
8 files changed, 31 insertions, 32 deletions
diff --git a/tests/check_framework/urls/beginning_with_slash.py b/tests/check_framework/urls/beginning_with_slash.py index 8dac96745c..bd4e29d8f1 100644 --- a/tests/check_framework/urls/beginning_with_slash.py +++ b/tests/check_framework/urls/beginning_with_slash.py @@ -1,7 +1,6 @@ -from django.conf.urls import url -from django.urls import path +from django.urls import path, re_path urlpatterns = [ path('/path-starting-with-slash/', lambda x: x), - url(r'/url-starting-with-slash/$', lambda x: x), + re_path(r'/url-starting-with-slash/$', lambda x: x), ] diff --git a/tests/check_framework/urls/include_with_dollar.py b/tests/check_framework/urls/include_with_dollar.py index 3d4a55b41f..ce921bbec5 100644 --- a/tests/check_framework/urls/include_with_dollar.py +++ b/tests/check_framework/urls/include_with_dollar.py @@ -1,5 +1,5 @@ -from django.conf.urls import include, url +from django.urls import include, re_path urlpatterns = [ - url(r'^include-with-dollar$', include([])), + re_path('^include-with-dollar$', include([])), ] diff --git a/tests/check_framework/urls/name_with_colon.py b/tests/check_framework/urls/name_with_colon.py index f7bc0c18b4..273c99324c 100644 --- a/tests/check_framework/urls/name_with_colon.py +++ b/tests/check_framework/urls/name_with_colon.py @@ -1,5 +1,5 @@ -from django.conf.urls import url +from django.urls import re_path urlpatterns = [ - url(r'^$', lambda x: x, name='name_with:colon'), + re_path('^$', lambda x: x, name='name_with:colon'), ] diff --git a/tests/check_framework/urls/no_warnings.py b/tests/check_framework/urls/no_warnings.py index 773ad27ef1..e1846fb884 100644 --- a/tests/check_framework/urls/no_warnings.py +++ b/tests/check_framework/urls/no_warnings.py @@ -1,9 +1,9 @@ -from django.conf.urls import include, url +from django.urls import include, path, re_path urlpatterns = [ - url(r'^foo/', lambda x: x, name='foo'), + path('foo/', lambda x: x, name='foo'), # This dollar is ok as it is escaped - url(r'^\$', include([ - url(r'^bar/$', lambda x: x, name='bar'), + re_path(r'^\$', include([ + path('bar/', lambda x: x, name='bar'), ])), ] diff --git a/tests/check_framework/urls/no_warnings_i18n.py b/tests/check_framework/urls/no_warnings_i18n.py index 7c494c7dc9..37da78f29d 100644 --- a/tests/check_framework/urls/no_warnings_i18n.py +++ b/tests/check_framework/urls/no_warnings_i18n.py @@ -1,7 +1,7 @@ -from django.conf.urls import url from django.conf.urls.i18n import i18n_patterns +from django.urls import path from django.utils.translation import gettext_lazy as _ urlpatterns = i18n_patterns( - url(_('translated/'), lambda x: x, name='i18n_prefixed'), + path(_('translated/'), lambda x: x, name='i18n_prefixed'), ) diff --git a/tests/check_framework/urls/non_unique_namespaces.py b/tests/check_framework/urls/non_unique_namespaces.py index 781be4c6d0..f036797cb7 100644 --- a/tests/check_framework/urls/non_unique_namespaces.py +++ b/tests/check_framework/urls/non_unique_namespaces.py @@ -1,13 +1,13 @@ -from django.conf.urls import include, url +from django.urls import include, path common_url_patterns = ([ - url(r'^app-ns1/', include([])), - url(r'^app-url/', include([])), + path('app-ns1/', include([])), + path('app-url/', include([])), ], 'app-ns1') urlpatterns = [ - url(r'^app-ns1-0/', include(common_url_patterns)), - url(r'^app-ns1-1/', include(common_url_patterns)), - url(r'^app-some-url/', include(([], 'app'), namespace='app-1')), - url(r'^app-some-url-2/', include(([], 'app'), namespace='app-1')) + path('app-ns1-0/', include(common_url_patterns)), + path('app-ns1-1/', include(common_url_patterns)), + path('app-some-url/', include(([], 'app'), namespace='app-1')), + path('app-some-url-2/', include(([], 'app'), namespace='app-1')) ] diff --git a/tests/check_framework/urls/unique_namespaces.py b/tests/check_framework/urls/unique_namespaces.py index b3f7fd70d0..09296648fd 100644 --- a/tests/check_framework/urls/unique_namespaces.py +++ b/tests/check_framework/urls/unique_namespaces.py @@ -1,20 +1,20 @@ -from django.conf.urls import include, url +from django.urls import include, path common_url_patterns = ([ - url(r'^app-ns1/', include([])), - url(r'^app-url/', include([])), + path('app-ns1/', include([])), + path('app-url/', include([])), ], 'common') nested_url_patterns = ([ - url(r'^common/', include(common_url_patterns, namespace='nested')), + path('common/', include(common_url_patterns, namespace='nested')), ], 'nested') urlpatterns = [ - url(r'^app-ns1-0/', include(common_url_patterns, namespace='app-include-1')), - url(r'^app-ns1-1/', include(common_url_patterns, namespace='app-include-2')), + path('app-ns1-0/', include(common_url_patterns, namespace='app-include-1')), + path('app-ns1-1/', include(common_url_patterns, namespace='app-include-2')), # 'nested' is included twice but namespaced by nested-1 and nested-2. - url(r'^app-ns1-2/', include(nested_url_patterns, namespace='nested-1')), - url(r'^app-ns1-3/', include(nested_url_patterns, namespace='nested-2')), + path('app-ns1-2/', include(nested_url_patterns, namespace='nested-1')), + path('app-ns1-3/', include(nested_url_patterns, namespace='nested-2')), # namespaced URLs inside non-namespaced URLs. - url(r'^app-ns1-4/', include([url(r'^abc/', include(common_url_patterns))])), + path('app-ns1-4/', include([path('abc/', include(common_url_patterns))])), ] diff --git a/tests/check_framework/urls/warning_in_include.py b/tests/check_framework/urls/warning_in_include.py index 5bb94c9688..8ec846be1e 100644 --- a/tests/check_framework/urls/warning_in_include.py +++ b/tests/check_framework/urls/warning_in_include.py @@ -1,7 +1,7 @@ -from django.conf.urls import include, url +from django.urls import include, path, re_path urlpatterns = [ - url(r'^', include([ - url(r'^include-with-dollar$', include([])), + path('', include([ + re_path('^include-with-dollar$', include([])), ])), ] |
