diff --git a/django/test/testcases.py b/django/test/testcases.py
index 4de4750..53ea02a 100644
a
|
b
|
from django.test.client import Client
|
31 | 31 | from django.test.utils import (get_warnings_state, restore_warnings_state, |
32 | 32 | override_settings) |
33 | 33 | from django.utils import simplejson, unittest as ut2 |
34 | | from django.utils.encoding import smart_str |
| 34 | from django.utils.encoding import smart_str, force_unicode |
35 | 35 | from django.views.static import serve |
36 | 36 | |
37 | 37 | __all__ = ('DocTestRunner', 'OutputChecker', 'TestCase', 'TransactionTestCase', |
… |
… |
class SimpleTestCase(ut2.TestCase):
|
335 | 335 | optional.clean(input) |
336 | 336 | self.assertEqual(context_manager.exception.messages, errors) |
337 | 337 | # test required inputs |
338 | | error_required = [u'This field is required.'] |
| 338 | error_required = [force_unicode(required.error_messages['required'])] |
339 | 339 | for e in EMPTY_VALUES: |
340 | 340 | with self.assertRaises(ValidationError) as context_manager: |
341 | 341 | required.clean(e) |
diff --git a/tests/regressiontests/test_utils/tests.py b/tests/regressiontests/test_utils/tests.py
index c192d51..eab6895 100644
a
|
b
|
|
1 | 1 | from __future__ import with_statement, absolute_import |
2 | 2 | |
3 | | from django.forms import EmailField |
| 3 | from django.forms import EmailField, IntegerField |
4 | 4 | from django.test import SimpleTestCase, TestCase, skipUnlessDBFeature |
5 | 5 | from django.utils.unittest import skip |
6 | 6 | |
… |
… |
class AssertFieldOutputTests(SimpleTestCase):
|
149 | 149 | self.assertRaises(AssertionError, self.assertFieldOutput, EmailField, {'a@a.com': 'Wrong output'}, {'aaa': error_invalid}) |
150 | 150 | self.assertRaises(AssertionError, self.assertFieldOutput, EmailField, {'a@a.com': 'a@a.com'}, {'aaa': [u'Come on, gimme some well formatted data, dude.']}) |
151 | 151 | |
| 152 | def test_custom_required_message(self): |
| 153 | class MyCustomField(IntegerField): |
| 154 | default_error_messages = { |
| 155 | 'required': u'This is really required.', |
| 156 | } |
| 157 | self.assertFieldOutput(MyCustomField, {}, {}, empty_value=None) |
152 | 158 | |
153 | 159 | __test__ = {"API_TEST": r""" |
154 | 160 | # Some checks of the doctest output normalizer. |