summaryrefslogtreecommitdiff
path: root/tests/forms_tests
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2018-08-07 18:04:48 -0400
committerTim Graham <timograham@gmail.com>2018-08-08 06:24:52 -0400
commit730173d1c5cf210d8e3bd951fa49f64b9bc561ca (patch)
treedcd7fdfdf443f2b879856e17477773ac0dfa0f2f /tests/forms_tests
parent9fee229874367beafd532dad6d0f9ff9676ded0b (diff)
Fixed #29623 -- Fixed translation failure of DurationField's "overflow" error message.
Diffstat (limited to 'tests/forms_tests')
-rw-r--r--tests/forms_tests/field_tests/test_durationfield.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/forms_tests/field_tests/test_durationfield.py b/tests/forms_tests/field_tests/test_durationfield.py
index 4eac37c102..2c2e17acd3 100644
--- a/tests/forms_tests/field_tests/test_durationfield.py
+++ b/tests/forms_tests/field_tests/test_durationfield.py
@@ -3,6 +3,7 @@ import datetime
from django.core.exceptions import ValidationError
from django.forms import DurationField
from django.test import SimpleTestCase
+from django.utils import translation
from django.utils.duration import duration_string
from . import FormFieldAssertionsMixin
@@ -31,6 +32,15 @@ class DurationFieldTest(FormFieldAssertionsMixin, SimpleTestCase):
with self.assertRaisesMessage(ValidationError, msg):
f.clean('-1000000000 00:00:00')
+ def test_overflow_translation(self):
+ msg = "Le nombre de jours doit ĂȘtre entre {min_days} et {max_days}.".format(
+ min_days=datetime.timedelta.min.days,
+ max_days=datetime.timedelta.max.days,
+ )
+ with translation.override('fr'):
+ with self.assertRaisesMessage(ValidationError, msg):
+ DurationField().clean('1000000000 00:00:00')
+
def test_durationfield_render(self):
self.assertWidgetRendersTo(
DurationField(initial=datetime.timedelta(hours=1)),