Exemple #1
0
 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")
Exemple #4
0
 def test_enforces_subset_columns(self):
     y = '''
     buildings:
         types:
             - polygons
         select:
             - column1 
         where: column2 IS NOT NULL
     other:
         types:
             - points
         select:
             - column3
     '''
     f = FeatureSelection(y)
     self.assertTrue(f.valid)
     self.assertEqual(f.key_union(), ['column1', 'column2', 'column3'])
     self.assertEqual(f.key_union('points'), ['column3'])
 def test_enforces_subset_columns(self):
     y = '''
     buildings:
         types:
             - polygons
         select:
             - column1 
         where: column2 IS NOT NULL
     other:
         types:
             - points
         select:
             - column3
     '''
     f = FeatureSelection(y)
     self.assertTrue(f.valid)
     self.assertEqual(f.key_union(), ['column1','column2','column3'])
     self.assertEqual(f.key_union('points'), ['column3'])
 def test_enforces_subset_columns(self):
     y = """
     buildings:
         types:
             - polygons
         select:
             - column1
         where: column2 IS NOT NULL
     other:
         types:
             - points
         select:
             - column3
     """
     f = FeatureSelection(y)
     self.assertTrue(f.valid)
     self.assertEqual(f.key_union(), ["column1", "column2", "column3"])
     self.assertEqual(f.key_union("points"), ["column3"])