From af5bcc3e5af6cca37e6e7dd24cb43f84db9637f5 Mon Sep 17 00:00:00 2001 From: Stefan Wojcik Date: Tue, 18 Jun 2019 15:31:58 +0200 Subject: [PATCH] Use str(exc) instead of exc.message --- tests/document/instance.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/document/instance.py b/tests/document/instance.py index 2579dd66d..ba087f0d6 100644 --- a/tests/document/instance.py +++ b/tests/document/instance.py @@ -354,7 +354,7 @@ class User(Document): class EmailUser(User): email = StringField(primary_key=True) exc = e.exception - self.assertEqual(exc.message, 'Cannot override primary key field') + self.assertEqual(str(exc), 'Cannot override primary key field') def test_custom_id_field_is_required(self): """Ensure the custom primary key field is required.""" @@ -365,7 +365,7 @@ class User(Document): with self.assertRaises(ValidationError) as e: User(name='test').save() exc = e.exception - self.assertTrue("Field is required: ['username']" in exc.message) + self.assertTrue("Field is required: ['username']" in str(exc)) def test_custom_id_field_save_doc_with_nothing_but_pk(self): """Ensure we can still save a doc even if it only has a PK."""