diff options
| author | django-bot <ops@djangoproject.com> | 2022-02-03 20:24:19 +0100 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2022-02-07 20:37:05 +0100 |
| commit | 9c19aff7c7561e3a82978a272ecdaad40dda5c00 (patch) | |
| tree | f0506b668a013d0063e5fba3dbf4863b466713ba /tests/check_framework/urls | |
| parent | f68fa8b45dfac545cfc4111d4e52804c86db68d3 (diff) | |
Refs #33476 -- Reformatted code with Black.
Diffstat (limited to 'tests/check_framework/urls')
17 files changed, 72 insertions, 53 deletions
diff --git a/tests/check_framework/urls/bad_error_handlers_invalid_path.py b/tests/check_framework/urls/bad_error_handlers_invalid_path.py index 77e0c639e0..9b42900703 100644 --- a/tests/check_framework/urls/bad_error_handlers_invalid_path.py +++ b/tests/check_framework/urls/bad_error_handlers_invalid_path.py @@ -1,6 +1,6 @@ urlpatterns = [] -handler400 = 'django.views.bad_handler' -handler403 = 'django.invalid_module.bad_handler' -handler404 = 'invalid_module.bad_handler' -handler500 = 'django' +handler400 = "django.views.bad_handler" +handler403 = "django.invalid_module.bad_handler" +handler404 = "invalid_module.bad_handler" +handler500 = "django" diff --git a/tests/check_framework/urls/bad_function_based_error_handlers.py b/tests/check_framework/urls/bad_function_based_error_handlers.py index d639d707df..518d2d4734 100644 --- a/tests/check_framework/urls/bad_function_based_error_handlers.py +++ b/tests/check_framework/urls/bad_function_based_error_handlers.py @@ -1,9 +1,9 @@ urlpatterns = [] -handler400 = __name__ + '.bad_handler' -handler403 = __name__ + '.bad_handler' -handler404 = __name__ + '.bad_handler' -handler500 = __name__ + '.bad_handler' +handler400 = __name__ + ".bad_handler" +handler403 = __name__ + ".bad_handler" +handler404 = __name__ + ".bad_handler" +handler500 = __name__ + ".bad_handler" def bad_handler(): diff --git a/tests/check_framework/urls/beginning_with_slash.py b/tests/check_framework/urls/beginning_with_slash.py index bd4e29d8f1..ce6c145512 100644 --- a/tests/check_framework/urls/beginning_with_slash.py +++ b/tests/check_framework/urls/beginning_with_slash.py @@ -1,6 +1,6 @@ from django.urls import path, re_path urlpatterns = [ - path('/path-starting-with-slash/', lambda x: x), - re_path(r'/url-starting-with-slash/$', lambda x: x), + path("/path-starting-with-slash/", lambda x: x), + re_path(r"/url-starting-with-slash/$", lambda x: x), ] diff --git a/tests/check_framework/urls/cbv_as_view.py b/tests/check_framework/urls/cbv_as_view.py index 932a2bfcc9..3a478afb94 100644 --- a/tests/check_framework/urls/cbv_as_view.py +++ b/tests/check_framework/urls/cbv_as_view.py @@ -13,7 +13,7 @@ class EmptyCallableView: urlpatterns = [ - path('missing_as_view', EmptyCBV), - path('has_as_view', EmptyCBV.as_view()), - path('callable_class', EmptyCallableView()), + path("missing_as_view", EmptyCBV), + path("has_as_view", EmptyCBV.as_view()), + path("callable_class", EmptyCallableView()), ] diff --git a/tests/check_framework/urls/contains_tuple.py b/tests/check_framework/urls/contains_tuple.py index 56aa3ea364..9fc58224a2 100644 --- a/tests/check_framework/urls/contains_tuple.py +++ b/tests/check_framework/urls/contains_tuple.py @@ -1,3 +1,3 @@ urlpatterns = [ - (r'^tuple/$', lambda x: x), + (r"^tuple/$", lambda x: x), ] diff --git a/tests/check_framework/urls/good_function_based_error_handlers.py b/tests/check_framework/urls/good_function_based_error_handlers.py index 69bea650f7..2479b253eb 100644 --- a/tests/check_framework/urls/good_function_based_error_handlers.py +++ b/tests/check_framework/urls/good_function_based_error_handlers.py @@ -1,10 +1,10 @@ urlpatterns = [] -handler400 = __name__ + '.good_handler' -handler403 = __name__ + '.good_handler' -handler404 = __name__ + '.good_handler' -handler500 = __name__ + '.good_handler' +handler400 = __name__ + ".good_handler" +handler403 = __name__ + ".good_handler" +handler404 = __name__ + ".good_handler" +handler500 = __name__ + ".good_handler" -def good_handler(request, exception=None, foo='bar'): +def good_handler(request, exception=None, foo="bar"): pass diff --git a/tests/check_framework/urls/include_contains_tuple.py b/tests/check_framework/urls/include_contains_tuple.py index 02717a743c..876d9aab1d 100644 --- a/tests/check_framework/urls/include_contains_tuple.py +++ b/tests/check_framework/urls/include_contains_tuple.py @@ -1,5 +1,5 @@ from django.urls import include, path urlpatterns = [ - path('', include([(r'^tuple/$', lambda x: x)])), + path("", include([(r"^tuple/$", lambda x: x)])), ] diff --git a/tests/check_framework/urls/include_with_dollar.py b/tests/check_framework/urls/include_with_dollar.py index ce921bbec5..dc92d594bf 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.urls import include, re_path urlpatterns = [ - re_path('^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 273c99324c..8cca009cd5 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.urls import re_path urlpatterns = [ - re_path('^$', 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 e1846fb884..d100f04590 100644 --- a/tests/check_framework/urls/no_warnings.py +++ b/tests/check_framework/urls/no_warnings.py @@ -1,9 +1,14 @@ from django.urls import include, path, re_path urlpatterns = [ - path('foo/', lambda x: x, name='foo'), + path("foo/", lambda x: x, name="foo"), # This dollar is ok as it is escaped - re_path(r'^\$', include([ - path('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 37da78f29d..4a125a24e6 100644 --- a/tests/check_framework/urls/no_warnings_i18n.py +++ b/tests/check_framework/urls/no_warnings_i18n.py @@ -3,5 +3,5 @@ from django.urls import path from django.utils.translation import gettext_lazy as _ urlpatterns = i18n_patterns( - path(_('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 f036797cb7..23f7f1b61d 100644 --- a/tests/check_framework/urls/non_unique_namespaces.py +++ b/tests/check_framework/urls/non_unique_namespaces.py @@ -1,13 +1,16 @@ from django.urls import include, path -common_url_patterns = ([ - path('app-ns1/', include([])), - path('app-url/', include([])), -], 'app-ns1') +common_url_patterns = ( + [ + path("app-ns1/", include([])), + path("app-url/", include([])), + ], + "app-ns1", +) urlpatterns = [ - 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')) + 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/path_compatibility/beginning_with_caret.py b/tests/check_framework/urls/path_compatibility/beginning_with_caret.py index 7e3e9c8707..27c96246b2 100644 --- a/tests/check_framework/urls/path_compatibility/beginning_with_caret.py +++ b/tests/check_framework/urls/path_compatibility/beginning_with_caret.py @@ -1,5 +1,5 @@ from django.urls import path urlpatterns = [ - path('^beginning-with-caret', lambda x: x), + path("^beginning-with-caret", lambda x: x), ] diff --git a/tests/check_framework/urls/path_compatibility/contains_re_named_group.py b/tests/check_framework/urls/path_compatibility/contains_re_named_group.py index bd849509f5..86897a4a48 100644 --- a/tests/check_framework/urls/path_compatibility/contains_re_named_group.py +++ b/tests/check_framework/urls/path_compatibility/contains_re_named_group.py @@ -1,5 +1,5 @@ from django.urls import path urlpatterns = [ - path(r'(?P<named_group>\d+)', lambda x: x), + path(r"(?P<named_group>\d+)", lambda x: x), ] diff --git a/tests/check_framework/urls/path_compatibility/ending_with_dollar.py b/tests/check_framework/urls/path_compatibility/ending_with_dollar.py index 0ea82a1ba6..081cc6b008 100644 --- a/tests/check_framework/urls/path_compatibility/ending_with_dollar.py +++ b/tests/check_framework/urls/path_compatibility/ending_with_dollar.py @@ -1,5 +1,5 @@ from django.urls import path urlpatterns = [ - path('ending-with-dollar$', lambda x: x), + path("ending-with-dollar$", lambda x: x), ] diff --git a/tests/check_framework/urls/unique_namespaces.py b/tests/check_framework/urls/unique_namespaces.py index 09296648fd..ee6cc5fd3e 100644 --- a/tests/check_framework/urls/unique_namespaces.py +++ b/tests/check_framework/urls/unique_namespaces.py @@ -1,20 +1,26 @@ from django.urls import include, path -common_url_patterns = ([ - path('app-ns1/', include([])), - path('app-url/', include([])), -], 'common') +common_url_patterns = ( + [ + path("app-ns1/", include([])), + path("app-url/", include([])), + ], + "common", +) -nested_url_patterns = ([ - path('common/', include(common_url_patterns, namespace='nested')), -], 'nested') +nested_url_patterns = ( + [ + path("common/", include(common_url_patterns, namespace="nested")), + ], + "nested", +) urlpatterns = [ - path('app-ns1-0/', include(common_url_patterns, namespace='app-include-1')), - path('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. - path('app-ns1-2/', include(nested_url_patterns, namespace='nested-1')), - path('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. - path('app-ns1-4/', include([path('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 8ec846be1e..6978c13210 100644 --- a/tests/check_framework/urls/warning_in_include.py +++ b/tests/check_framework/urls/warning_in_include.py @@ -1,7 +1,12 @@ from django.urls import include, path, re_path urlpatterns = [ - path('', include([ - re_path('^include-with-dollar$', include([])), - ])), + path( + "", + include( + [ + re_path("^include-with-dollar$", include([])), + ] + ), + ), ] |
