From 46dcdf9a29ddc5b687bcf0491e013548a6f44281 Mon Sep 17 00:00:00 2001 From: Tim Graham Date: Wed, 20 Sep 2017 10:22:30 -0400 Subject: [PATCH] Added a checks test for valid i18n patterns. --- tests/check_framework/test_urls.py | 4 ++++ tests/check_framework/urls/no_warnings_i18n.py | 7 +++++++ 2 files changed, 11 insertions(+) create mode 100644 tests/check_framework/urls/no_warnings_i18n.py diff --git a/tests/check_framework/test_urls.py b/tests/check_framework/test_urls.py index b60578cbdb..07acab599b 100644 --- a/tests/check_framework/test_urls.py +++ b/tests/check_framework/test_urls.py @@ -14,6 +14,10 @@ class CheckUrlConfigTests(SimpleTestCase): result = check_url_config(None) self.assertEqual(result, []) + @override_settings(ROOT_URLCONF='check_framework.urls.no_warnings_i18n') + def test_no_warnings_i18n(self): + self.assertEqual(check_url_config(None), []) + @override_settings(ROOT_URLCONF='check_framework.urls.warning_in_include') def test_check_resolver_recursive(self): # The resolver is checked recursively (examining url()s in include()). diff --git a/tests/check_framework/urls/no_warnings_i18n.py b/tests/check_framework/urls/no_warnings_i18n.py new file mode 100644 index 0000000000..7c494c7dc9 --- /dev/null +++ b/tests/check_framework/urls/no_warnings_i18n.py @@ -0,0 +1,7 @@ +from django.conf.urls import url +from django.conf.urls.i18n import i18n_patterns +from django.utils.translation import gettext_lazy as _ + +urlpatterns = i18n_patterns( + url(_('translated/'), lambda x: x, name='i18n_prefixed'), +)