diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/modeltests/validators/tests.py | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/tests/modeltests/validators/tests.py b/tests/modeltests/validators/tests.py index 6c1e6d780f..44ad176747 100644 --- a/tests/modeltests/validators/tests.py +++ b/tests/modeltests/validators/tests.py @@ -137,7 +137,20 @@ def create_simple_test_method(validator, expected, value, num): # Dynamically assemble a test class with the contents of TEST_DATA class TestSimpleValidators(TestCase): - pass + def test_single_message(self): + v = ValidationError('Not Valid') + self.assertEquals(str(v), "[u'Not Valid']") + self.assertEquals(repr(v), "ValidationError([u'Not Valid'])") + + def test_message_list(self): + v = ValidationError(['First Problem', 'Second Problem']) + self.assertEquals(str(v), "[u'First Problem', u'Second Problem']") + self.assertEquals(repr(v), "ValidationError([u'First Problem', u'Second Problem'])") + + def test_message_dict(self): + v = ValidationError({'first': 'First Problem'}) + self.assertEquals(str(v), "{'first': 'First Problem'}") + self.assertEquals(repr(v), "ValidationError({'first': 'First Problem'})") test_counter = 0 for validator, value, expected in TEST_DATA: |
