fix associated test to avoid discrepencies btw py2 and py3
This commit is contained in:
parent
8bf5370b6c
commit
54ca7bf09f
@ -3670,13 +3670,16 @@ class TestInstance(MongoDBTestCase):
|
|||||||
_ = list(Jedi.objects) # Ensure a proper document loads without errors
|
_ = list(Jedi.objects) # Ensure a proper document loads without errors
|
||||||
|
|
||||||
# Forces a document with a wrong shape (may occur in case of migration)
|
# Forces a document with a wrong shape (may occur in case of migration)
|
||||||
coll.insert_one({"light_saber": "I_should_be_a_dict"})
|
value = u"I_should_be_a_dict"
|
||||||
|
coll.insert_one({"light_saber": value})
|
||||||
|
|
||||||
with self.assertRaises(InvalidDocumentError) as cm:
|
with self.assertRaises(InvalidDocumentError) as cm:
|
||||||
list(Jedi.objects)
|
list(Jedi.objects)
|
||||||
|
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
str(cm.exception),
|
str(cm.exception),
|
||||||
"Invalid data to create a `Jedi` instance.\nField 'light_saber' - The source SON object needs to be of type 'dict' but a '<type 'unicode'>' was found",
|
"Invalid data to create a `Jedi` instance.\nField 'light_saber' - The source SON object needs to be of type 'dict' but a '%s' was found"
|
||||||
|
% type(value),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user