From f2cbcea6d77e5fd9408aa5ec6c6e6af5c3683f46 Mon Sep 17 00:00:00 2001 From: Matthew Ellison Date: Wed, 29 Apr 2015 14:26:05 -0400 Subject: [PATCH] Unit Tests for #954 Fail on Exception, not Error --- tests/document/validation.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tests/document/validation.py b/tests/document/validation.py index 8498a740..ba03366e 100644 --- a/tests/document/validation.py +++ b/tests/document/validation.py @@ -183,7 +183,10 @@ class ValidatorErrorTest(unittest.TestCase): child = Child(reference=parent) # Saving child should not raise a ValidationError - child.save() + try: + child.save() + except ValidationError as e: + self.fail("ValidationError raised: %s" % e.message) def test_parent_reference_set_as_attribute_in_child_document(self): """ @@ -204,7 +207,11 @@ class ValidatorErrorTest(unittest.TestCase): child.reference = parent # Saving the child should not raise a ValidationError - child.save() + try: + child.save() + except ValidationError as e: + self.fail("ValidationError raised: %s" % e.message) + if __name__ == '__main__': unittest.main()