def test_key_union_and_filters(self): y = ''' waterways: types: - lines - polygons select: - name - waterway buildings: types: - points - lines - polygons select: - name - building where: building IS NOT NULL ''' f = FeatureSelection(y) self.assertCountEqual(f.themes, ['buildings', 'waterways']) self.assertCountEqual(f.geom_types('waterways'), ['lines', 'polygons']) self.assertCountEqual(f.key_selections('waterways'), ['name', 'waterway']) self.assertEqual(f.filter_clause('waterways'), '"name" IS NOT NULL OR "waterway" IS NOT NULL') self.assertCountEqual(f.key_union(), ['building', 'name', 'waterway']) self.assertCountEqual(f.key_union('points'), ['building', 'name']) self.assertEqual(f.filter_clause('buildings'), 'building IS NOT NULL')
def test_key_union_and_filters(self): y = ''' waterways: types: - lines - polygons select: - name - waterway buildings: types: - points - lines - polygons select: - name - building where: building IS NOT NULL ''' f = FeatureSelection(y) self.assertCountEqual(f.themes,['buildings','waterways']) self.assertCountEqual(f.geom_types('waterways'),['lines','polygons']) self.assertCountEqual(f.key_selections('waterways'),['name','waterway']) self.assertEqual(f.filter_clause('waterways'),'"name" IS NOT NULL OR "waterway" IS NOT NULL') self.assertCountEqual(f.key_union(), ['building','name','waterway']) self.assertCountEqual(f.key_union('points'), ['building','name']) self.assertEqual(f.filter_clause('buildings'),'building IS NOT NULL')
def test_key_union_and_filters(self): y = """ waterways: types: - lines - polygons select: - name - waterway buildings: types: - points - lines - polygons select: - name - building where: building IS NOT NULL """ f = FeatureSelection(y) self.assertCountEqual(f.themes, ["buildings", "waterways"]) self.assertCountEqual(f.geom_types("waterways"), ["lines", "polygons"]) self.assertCountEqual(f.key_selections("waterways"), ["name", "waterway"]) self.assertEqual(f.filter_clause("waterways"), '"name" IS NOT NULL OR "waterway" IS NOT NULL') self.assertCountEqual(f.key_union(), ["building", "name", "waterway"]) self.assertCountEqual(f.key_union("points"), ["building", "name"]) self.assertEqual(f.filter_clause("buildings"), "building IS NOT NULL")
def test_minimal_yaml(self): # the shortest valid feature selection y = ''' all: select: - name ''' f = FeatureSelection(y) self.assertTrue(f.valid) self.assertEqual(f.geom_types('all'), ['points', 'lines', 'polygons'])
def test_minimal_yaml(self): # the shortest valid feature selection y = ''' all: select: - name ''' f = FeatureSelection(y) self.assertTrue(f.valid) self.assertEqual(f.geom_types('all'),['points','lines','polygons'])
def test_minimal_yaml(self): # the shortest valid feature selection y = """ all: select: - name """ f = FeatureSelection(y) self.assertTrue(f.valid) self.assertEqual(f.geom_types("all"), ["points", "lines", "polygons"])