def test_deserialize(self): ## fixme: this should fail with no spillable area ?!? jsblob = self.map.serialize() jsblob['spillable_area'] = None pprint(jsblob) # {'approximate_raster_interval': 53.9608870724, # 'filename': u'/Users/chris.barker/Hazmat/GitLab/pygnome/py_gnome/tests/unit_tests/sample_data/florida_with_lake_small.bna', # 'id': u'b3590b7d-aab1-11ea-8899-1e00b098d304', # 'map_bounds': [(-82.8609915978, 24.5472415066), # (-82.8609915978, 28.1117673335), # (-80.0313642811, 28.1117673335), # (-80.0313642811, 24.5472415066)], # 'name': u'MapFromBNA_8', # 'obj_type': u'gnome.maps.map.MapFromBNA', # 'raster_size': 16777216.0, # 'refloat_halflife': 1.0} map = MapFromBNA.deserialize(jsblob) print map.spillable_area print map.land_polys assert map.spillable_area is None assert len(map.map_bounds) == 4
def test_serialize_deserialize(self): """ test create new object from to_dict """ gmap = MapFromBNA(testbnamap, 6) serial = gmap.serialize() map2 = MapFromBNA.deserialize(serial) assert gmap == map2