Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #20059 -- Updated humanize tests to force 'en' language setting.

  • Loading branch information...
commit 86aaff75d09fb9c801ec29d1f961cd4706043be9 1 parent 5080311
Matias Bordese authored March 17, 2013 apollo13 committed March 30, 2013

Showing 1 changed file with 17 additions and 10 deletions. Show diff stats Hide diff stats

  1. 27  django/contrib/humanize/tests.py
27  django/contrib/humanize/tests.py
@@ -53,7 +53,8 @@ def test_ordinal(self):
53 53
                        '12th', '13th', '101st', '102nd', '103rd',
54 54
                        '111th', 'something else', None)
55 55
 
56  
-        self.humanize_tester(test_list, result_list, 'ordinal')
  56
+        with translation.override('en'):
  57
+            self.humanize_tester(test_list, result_list, 'ordinal')
57 58
 
58 59
     def test_intcomma(self):
59 60
         test_list = (100, 1000, 10123, 10311, 1000000, 1234567.25,
@@ -63,7 +64,8 @@ def test_intcomma(self):
63 64
                        '100', '1,000', '10,123', '10,311', '1,000,000', '1,234,567.1234567', '1,234,567.1234567',
64 65
                      None)
65 66
 
66  
-        self.humanize_tester(test_list, result_list, 'intcomma')
  67
+        with translation.override('en'):
  68
+            self.humanize_tester(test_list, result_list, 'intcomma')
67 69
 
68 70
     def test_l10n_intcomma(self):
69 71
         test_list = (100, 1000, 10123, 10311, 1000000, 1234567.25,
@@ -74,7 +76,8 @@ def test_l10n_intcomma(self):
74 76
                      None)
75 77
 
76 78
         with self.settings(USE_L10N=True, USE_THOUSAND_SEPARATOR=False):
77  
-            self.humanize_tester(test_list, result_list, 'intcomma')
  79
+            with translation.override('en'):
  80
+                self.humanize_tester(test_list, result_list, 'intcomma')
78 81
 
79 82
     def test_intcomma_without_number_grouping(self):
80 83
         # Regression for #17414
@@ -91,7 +94,8 @@ def test_intword(self):
91 94
                        '1.0 billion', '2.0 billion', '6.0 trillion',
92 95
                        '1.3 quadrillion', '3.5 sextillion',
93 96
                        '8.1 decillion', None)
94  
-        self.humanize_tester(test_list, result_list, 'intword')
  97
+        with translation.override('en'):
  98
+            self.humanize_tester(test_list, result_list, 'intword')
95 99
 
96 100
     def test_i18n_intcomma(self):
97 101
         test_list = (100, 1000, 10123, 10311, 1000000, 1234567.25,
@@ -116,8 +120,8 @@ def test_apnumber(self):
116 120
         test_list.append(None)
117 121
         result_list = ('one', 'two', 'three', 'four', 'five', 'six',
118 122
                        'seven', 'eight', 'nine', '10', None)
119  
-
120  
-        self.humanize_tester(test_list, result_list, 'apnumber')
  123
+        with translation.override('en'):
  124
+            self.humanize_tester(test_list, result_list, 'apnumber')
121 125
 
122 126
     def test_naturalday(self):
123 127
         today = datetime.date.today()
@@ -157,7 +161,8 @@ def test_naturalday_uses_localtime(self):
157 161
         orig_humanize_datetime, humanize.datetime = humanize.datetime, MockDateTime
158 162
         try:
159 163
             with override_settings(TIME_ZONE="America/Chicago", USE_TZ=True):
160  
-                self.humanize_tester([dt], ['yesterday'], 'naturalday')
  164
+                with translation.override('en'):
  165
+                    self.humanize_tester([dt], ['yesterday'], 'naturalday')
161 166
         finally:
162 167
             humanize.datetime = orig_humanize_datetime
163 168
 
@@ -218,8 +223,10 @@ def utcoffset(self, dt):
218 223
 
219 224
         orig_humanize_datetime, humanize.datetime = humanize.datetime, MockDateTime
220 225
         try:
221  
-            self.humanize_tester(test_list, result_list, 'naturaltime')
222  
-            with override_settings(USE_TZ=True):
223  
-                self.humanize_tester(test_list, result_list_with_tz_support, 'naturaltime')
  226
+            with translation.override('en'):
  227
+                self.humanize_tester(test_list, result_list, 'naturaltime')
  228
+                with override_settings(USE_TZ=True):
  229
+                    self.humanize_tester(
  230
+                        test_list, result_list_with_tz_support, 'naturaltime')
224 231
         finally:
225 232
             humanize.datetime = orig_humanize_datetime

0 notes on commit 86aaff7

Please sign in to comment.
Something went wrong with that request. Please try again.