def test_deserializeFromDictionary_ShouldDeserializeJsonDictionaryObjecToRelatedObject(self): employeeJsonDictionary = Employee.createSampleDictionary() jsonDeserializer = Deserializer() employeeInstance = jsonDeserializer.deserialize_from_dictionary(employeeJsonDictionary) assert employeeInstance is not None assert employeeInstance.Birthdate is not None assert isinstance(employeeInstance, Employee)
def _get_result(self, document): result = None if document: json_deserializer = Deserializer() json_deserializer.add_backend("bson.json_util") result = json_deserializer.deserialize_from_dictionary(document) result._id = str(result._id) return result
def _get_result(self, document): result = None if document: json_deserializer = Deserializer() json_deserializer.add_backend("bson.json_util") result = json_deserializer.deserialize_from_dictionary(document) if isinstance(result, dict): result["_id"] = str(result["_id"]) else: result._id = str(result._id) return result