From 54ca7bf09fa70a4fba3d83d8fc77090cddaaae67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastien=20G=C3=A9rard?= Date: Mon, 28 Oct 2019 22:38:21 +0100 Subject: [PATCH] fix associated test to avoid discrepencies btw py2 and py3 --- tests/document/test_instance.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/document/test_instance.py b/tests/document/test_instance.py index 60e5313d..7a868d29 100644 --- a/tests/document/test_instance.py +++ b/tests/document/test_instance.py @@ -3670,13 +3670,16 @@ class TestInstance(MongoDBTestCase): _ = list(Jedi.objects) # Ensure a proper document loads without errors # 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: list(Jedi.objects) + self.assertEqual( 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 '' 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), )