diff options
| author | Claude Paroz <claude@2xlibre.net> | 2016-12-01 21:22:16 +0100 |
|---|---|---|
| committer | Claude Paroz <claude@2xlibre.net> | 2016-12-21 17:40:08 +0100 |
| commit | 1206d7fa5793a86ffadeacb2e9280b11d474a58a (patch) | |
| tree | 97e2531c7f8abb08cf78f7019339dd3ea894218d /tests | |
| parent | 0a8c685447eea8fc7aa34ea444a3156ee489379f (diff) | |
Refs #25753 -- Reset l10n cache when format settings change
Thanks Jaap Roes for the initial patch.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/admin_views/tests.py | 6 | ||||
| -rw-r--r-- | tests/i18n/tests.py | 23 |
2 files changed, 11 insertions, 18 deletions
diff --git a/tests/admin_views/tests.py b/tests/admin_views/tests.py index b65439f8ac..2d86487e51 100644 --- a/tests/admin_views/tests.py +++ b/tests/admin_views/tests.py @@ -186,9 +186,6 @@ class AdminViewBasicTestCase(TestCase): def setUp(self): self.client.force_login(self.superuser) - def tearDown(self): - formats.reset_format_cache() - def assertContentBefore(self, response, text1, text2, failing_msg=None): """ Testing utility asserting that text1 appears before text2 in response @@ -5301,9 +5298,6 @@ class DateHierarchyTests(TestCase): def setUp(self): self.client.force_login(self.superuser) - def tearDown(self): - formats.reset_format_cache() - def assert_non_localized_year(self, response, year): """ The year is not localized with USE_THOUSAND_SEPARATOR (#15234). diff --git a/tests/i18n/tests.py b/tests/i18n/tests.py index fdd8903e0f..ed267ef1d6 100644 --- a/tests/i18n/tests.py +++ b/tests/i18n/tests.py @@ -731,17 +731,16 @@ class FormattingTests(SimpleTestCase): even if they would be interpreted as False in a conditional test (e.g. 0 or empty string) (#16938). """ - with patch_formats('fr', THOUSAND_SEPARATOR='', FIRST_DAY_OF_WEEK=0): - with translation.override('fr'): - with self.settings(USE_THOUSAND_SEPARATOR=True, THOUSAND_SEPARATOR='!'): - self.assertEqual('', get_format('THOUSAND_SEPARATOR')) - # Even a second time (after the format has been cached)... - self.assertEqual('', get_format('THOUSAND_SEPARATOR')) + with translation.override('fr'): + with self.settings(USE_THOUSAND_SEPARATOR=True, THOUSAND_SEPARATOR='!'): + self.assertEqual('\xa0', get_format('THOUSAND_SEPARATOR')) + # Even a second time (after the format has been cached)... + self.assertEqual('\xa0', get_format('THOUSAND_SEPARATOR')) - with self.settings(FIRST_DAY_OF_WEEK=1): - self.assertEqual(0, get_format('FIRST_DAY_OF_WEEK')) - # Even a second time (after the format has been cached)... - self.assertEqual(0, get_format('FIRST_DAY_OF_WEEK')) + with self.settings(FIRST_DAY_OF_WEEK=0): + self.assertEqual(1, get_format('FIRST_DAY_OF_WEEK')) + # Even a second time (after the format has been cached)... + self.assertEqual(1, get_format('FIRST_DAY_OF_WEEK')) def test_l10n_enabled(self): self.maxDiff = 3000 @@ -1161,8 +1160,8 @@ class FormattingTests(SimpleTestCase): with self.settings(USE_THOUSAND_SEPARATOR=True, USE_L10N=False): self.assertEqual(sanitize_separators('12\xa0345'), '12\xa0345') - with patch_formats(get_language(), THOUSAND_SEPARATOR='.', DECIMAL_SEPARATOR=','): - with self.settings(USE_THOUSAND_SEPARATOR=True): + with self.settings(USE_THOUSAND_SEPARATOR=True): + with patch_formats(get_language(), THOUSAND_SEPARATOR='.', DECIMAL_SEPARATOR=','): self.assertEqual(sanitize_separators('10.234'), '10234') # Suspicion that user entered dot as decimal separator (#22171) self.assertEqual(sanitize_separators('10.10'), '10.10') |
