def test_serialization_deserialization(self): """ tests serializatin/deserialization of the Spill object """ spill = point_line_release_spill(num_elements=self.num_elements, start_position=self.start_position, release_time=self.release_time) serial = spill.serialize('create') new_dict = Spill.deserialize(serial) # classmethod new_spill = Spill.new_from_dict(new_dict) # classmethod assert spill == new_spill
def test_serialization_deserialization(self, json_, amount, units): """ tests serializatin/deserialization of the Spill object """ spill = point_line_release_spill(num_elements=self.num_elements, start_position=self.start_position, release_time=self.release_time, amount=amount, units=units) new_spill = Spill.deserialize(spill.serialize()) assert new_spill == spill
def test_serialization_deserialization(self, json_): """ tests serializatin/deserialization of the Spill object """ spill = point_line_release_spill(num_elements=self.num_elements, start_position=self.start_position, release_time=self.release_time) dict_ = Spill.deserialize(spill.serialize(json_)) if json_ == 'save': new_spill = Spill.new_from_dict(dict_) assert spill == new_spill else: # for webapi, make new objects from nested objects before creating # new element_type dict_['element_type'] = spill.element_type dict_['release'] = spill.release new_spill = Spill.new_from_dict(dict_) assert True
def test_serialization_deserialization(self, json_, amount, units): """ tests serializatin/deserialization of the Spill object """ spill = point_line_release_spill(num_elements=self.num_elements, start_position=self.start_position, release_time=self.release_time, amount=amount, units=units) dict_ = Spill.deserialize(spill.serialize(json_)) if json_ == 'save': new_spill = Spill.new_from_dict(dict_) assert spill == new_spill else: # for webapi, make new objects from nested objects before creating # new element_type dict_['element_type'] = spill.element_type dict_['release'] = spill.release new_spill = Spill.new_from_dict(dict_) assert True