Skip to content

Instantly share code, notes, and snippets.

@loic
Created November 29, 2013 16:30
Show Gist options
  • Save loic/7708268 to your computer and use it in GitHub Desktop.
Save loic/7708268 to your computer and use it in GitHub Desktop.
diff --git a/tests/forms_tests/tests/test_forms.py b/tests/forms_tests/tests/test_forms.py
index 7f30b0e..faccda1 100644
--- a/tests/forms_tests/tests/test_forms.py
+++ b/tests/forms_tests/tests/test_forms.py
@@ -693,6 +693,7 @@ class FormsTestCase(TestCase):
self.add_error('password1', 'Forbidden value 2.')
if self.cleaned_data.get('password2') == 'FORBIDDEN_VALUE2':
self.add_error('password2', 'Forbidden value 2.')
+ raise ValidationError("I'm a non field error.")
return self.cleaned_data
@@ -729,7 +730,7 @@ class FormsTestCase(TestCase):
self.assertEqual(f.errors['password2'], ['Forbidden value.'])
f = UserRegistration({'username': 'adrian', 'password1': 'FORBIDDEN_VALUE2', 'password2': 'FORBIDDEN_VALUE2'}, auto_id=False)
- self.assertEqual(f.errors['__all__'], ['Forbidden value 2.'])
+ self.assertEqual(f.errors['__all__'], ['Forbidden value 2.', "I'm a non field error."])
self.assertEqual(f.errors['password1'], ['Forbidden value 2.'])
self.assertEqual(f.errors['password2'], ['Forbidden value 2.'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment