def test_none_geom(self): """Test a NoneType geometry will pass through the Fiona converter.""" rd = self.test_data.get_rd('cancm4_tas') slc = [None, 0, None, [10, 20], [10, 20]] ops = ocgis.OcgOperations(dataset=rd, slice=slc) subset = SubsetOperation(ops) conv = ShpConverter(subset, outdir=self.current_dir_output, prefix='shpconv') conv.write() contents = os.listdir(self.current_dir_output) self.assertEqual(len(contents), 5)
def test_attributes_copied(self): """Test attributes in geometry dictionaries are properly accounted for in the converter.""" subset = self.get_subset_operation() conv = ShpConverter(subset, outdir=self.current_dir_output, prefix='shpconv') ret = conv.write() path_ugid = os.path.join(self.current_dir_output, conv.prefix + '_ugid.shp') with fiona.open(path_ugid) as source: self.assertEqual(source.schema['properties'], OrderedDict([(u'COUNTRY', 'str:80'), (u'UGID', 'int:10')]))