diff options
author | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2023-01-06 14:46:33 +0100 |
---|---|---|
committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2023-01-17 11:49:15 +0100 |
commit | 8d98f99a4ab5de6f2c730399f53eba8bf6bea470 (patch) | |
tree | c9c643c4c77b0d5fb014270f62ba2ca193befc8a /tests/timezones | |
parent | 0be8095b254fad65b2480d677ebe6098c41bbad6 (diff) | |
download | django-8d98f99a4ab5de6f2c730399f53eba8bf6bea470.tar.gz |
Refs #32873 -- Removed settings.USE_L10N per deprecation timeline.
Diffstat (limited to 'tests/timezones')
-rw-r--r-- | tests/timezones/tests.py | 46 |
1 files changed, 6 insertions, 40 deletions
diff --git a/tests/timezones/tests.py b/tests/timezones/tests.py index dab481068b..f5c8d17a3c 100644 --- a/tests/timezones/tests.py +++ b/tests/timezones/tests.py @@ -38,7 +38,7 @@ from django.test import ( ) from django.test.utils import requires_tz_support from django.urls import reverse -from django.utils import timezone +from django.utils import timezone, translation from django.utils.deprecation import RemovedInDjango50Warning from django.utils.timezone import timedelta @@ -968,18 +968,9 @@ class SerializationTests(SimpleTestCase): self.assertEqual(obj.dt, dt) -# RemovedInDjango50Warning: When the deprecation ends, remove setUpClass() and -# USE_L10N=False. The tests should remain because format-related settings will -# take precedence over locale-dictated formats. -@override_settings( - DATETIME_FORMAT="c", TIME_ZONE="Africa/Nairobi", USE_L10N=False, USE_TZ=True -) +@translation.override(None) +@override_settings(DATETIME_FORMAT="c", TIME_ZONE="Africa/Nairobi", USE_TZ=True) class TemplateTests(SimpleTestCase): - @classmethod - def setUpClass(cls): - with ignore_warnings(category=RemovedInDjango50Warning): - super().setUpClass() - @requires_tz_support def test_localtime_templatetag_and_filters(self): """ @@ -1280,18 +1271,8 @@ class TemplateTests(SimpleTestCase): self.assertEqual(tpl.render(Context({})), "+0700") -# RemovedInDjango50Warning: When the deprecation ends, remove setUpClass() and -# USE_L10N=False. The tests should remain because format-related settings will -# take precedence over locale-dictated formats. -@override_settings( - DATETIME_FORMAT="c", TIME_ZONE="Africa/Nairobi", USE_L10N=False, USE_TZ=False -) +@override_settings(DATETIME_FORMAT="c", TIME_ZONE="Africa/Nairobi", USE_TZ=False) class LegacyFormsTests(TestCase): - @classmethod - def setUpClass(cls): - with ignore_warnings(category=RemovedInDjango50Warning): - super().setUpClass() - def test_form(self): form = EventForm({"dt": "2011-09-01 13:20:30"}) self.assertTrue(form.is_valid()) @@ -1336,18 +1317,8 @@ class LegacyFormsTests(TestCase): self.assertEqual(e.dt, datetime.datetime(2011, 9, 1, 13, 20, 30)) -# RemovedInDjango50Warning: When the deprecation ends, remove setUpClass() and -# USE_L10N=False. The tests should remain because format-related settings will -# take precedence over locale-dictated formats. -@override_settings( - DATETIME_FORMAT="c", TIME_ZONE="Africa/Nairobi", USE_L10N=False, USE_TZ=True -) +@override_settings(DATETIME_FORMAT="c", TIME_ZONE="Africa/Nairobi", USE_TZ=True) class NewFormsTests(TestCase): - @classmethod - def setUpClass(cls): - with ignore_warnings(category=RemovedInDjango50Warning): - super().setUpClass() - @requires_tz_support def test_form(self): form = EventForm({"dt": "2011-09-01 13:20:30"}) @@ -1426,20 +1397,15 @@ class NewFormsTests(TestCase): self.assertIn("2011-09-01 17:20:30", str(form)) +@translation.override(None) @override_settings( DATETIME_FORMAT="c", TIME_ZONE="Africa/Nairobi", - USE_L10N=False, USE_TZ=True, ROOT_URLCONF="timezones.urls", ) class AdminTests(TestCase): @classmethod - def setUpClass(cls): - with ignore_warnings(category=RemovedInDjango50Warning): - super().setUpClass() - - @classmethod def setUpTestData(cls): cls.u1 = User.objects.create_user( password="secret", |