Skip to content

Commit

Permalink
Use str(exc) instead of exc.message
Browse files Browse the repository at this point in the history
  • Loading branch information
wojcikstefan committed Jun 18, 2019
1 parent e089ef2 commit af5bcc3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tests/document/instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
Expand All @@ -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."""
Expand Down

0 comments on commit af5bcc3

Please sign in to comment.