def test_validationInputsMax(self): """ Test the GaiaProcess.validate() function - fail on > max input types """ vector_io1 = VectorFileIO(uri='/fake/path') vector_io2 = VectorFileIO(uri='/fake/path') with self.assertRaises(geo.GaiaException) as ge: geo.LengthProcess(inputs=[vector_io1, vector_io2]) self.assertIn('Incorrect # of inputs; expected 1', str(ge.exception))
def test_length(self): """ Test LengthProcess for vector inputs """ vector_roads = VectorFileIO(uri=os.path.join(testfile_path, 'iraq_roads.geojson'), filters=[('type', '=', 'motorway'), ('bridge', '=', 1)]) process = geo.LengthProcess(inputs=[vector_roads]) try: process.compute() with open( os.path.join(testfile_path, 'length_process_results.json')) as exp: expected_json = json.load(exp) actual_json = json.loads(process.output.read(format=formats.JSON)) self.assertEquals(len(expected_json['features']), len(actual_json['features'])) finally: if process: process.purge()