diff options
Diffstat (limited to 'django/contrib/humanize/tests.py')
-rw-r--r-- | django/contrib/humanize/tests.py | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/django/contrib/humanize/tests.py b/django/contrib/humanize/tests.py index f1fcbf2bb3..02f73afadb 100644 --- a/django/contrib/humanize/tests.py +++ b/django/contrib/humanize/tests.py @@ -77,15 +77,14 @@ class HumanizeTests(TransRealMixin, TestCase): '100', '1,000', '10,123', '10,311', '1,000,000', '1,234,567.1234567', '1,234,567.1234567', None) - with self.settings(USE_L10N=True, USE_THOUSAND_SEPARATOR=False): - with translation.override('en'): - self.humanize_tester(test_list, result_list, 'intcomma') + with self.settings(USE_L10N=True, USE_THOUSAND_SEPARATOR=False), \ + translation.override('en'): + self.humanize_tester(test_list, result_list, 'intcomma') def test_intcomma_without_number_grouping(self): # Regression for #17414 - with translation.override('ja'): - with self.settings(USE_L10N=True): - self.humanize_tester([100], ['100'], 'intcomma') + with translation.override('ja'), self.settings(USE_L10N=True): + self.humanize_tester([100], ['100'], 'intcomma') def test_intword(self): test_list = ('100', '1000000', '1200000', '1290000', @@ -104,18 +103,18 @@ class HumanizeTests(TransRealMixin, TestCase): '100', '1000', '10123', '10311', '1000000', None) result_list = ('100', '1.000', '10.123', '10.311', '1.000.000', '1.234.567,25', '100', '1.000', '10.123', '10.311', '1.000.000', None) - with self.settings(USE_L10N=True, USE_THOUSAND_SEPARATOR=True): - with translation.override('de'): - self.humanize_tester(test_list, result_list, 'intcomma') + with self.settings(USE_L10N=True, USE_THOUSAND_SEPARATOR=True), \ + translation.override('de'): + self.humanize_tester(test_list, result_list, 'intcomma') def test_i18n_intword(self): test_list = ('100', '1000000', '1200000', '1290000', '1000000000', '2000000000', '6000000000000') result_list = ('100', '1,0 Million', '1,2 Millionen', '1,3 Millionen', '1,0 Milliarde', '2,0 Milliarden', '6,0 Billionen') - with self.settings(USE_L10N=True, USE_THOUSAND_SEPARATOR=True): - with translation.override('de'): - self.humanize_tester(test_list, result_list, 'intword') + with self.settings(USE_L10N=True, USE_THOUSAND_SEPARATOR=True), \ + translation.override('de'): + self.humanize_tester(test_list, result_list, 'intword') def test_apnumber(self): test_list = [str(x) for x in range(1, 11)] @@ -162,9 +161,9 @@ class HumanizeTests(TransRealMixin, TestCase): orig_humanize_datetime, humanize.datetime = humanize.datetime, MockDateTime try: - with override_settings(TIME_ZONE="America/Chicago", USE_TZ=True): - with translation.override('en'): - self.humanize_tester([dt], ['yesterday'], 'naturalday') + with override_settings(TIME_ZONE="America/Chicago", USE_TZ=True), \ + translation.override('en'): + self.humanize_tester([dt], ['yesterday'], 'naturalday') finally: humanize.datetime = orig_humanize_datetime |