示例#1
0
 def test_no_select(self):
     y = '''
     buildings:
       types:
         - polygons
     '''
     m, errors = Mapping.validate(y)
     self.assertTrue(m is None)
     self.assertTrue(len(errors) == 1)
示例#2
0
 def test_wrong_yaml_list(self):
     y = '''
     buildings:
       types: polygons
       select:
         - building
     '''
     m, errors = Mapping.validate(y)
     self.assertTrue(m is None)
     self.assertTrue(len(errors) == 1)
示例#3
0
 def test_wrong_toplevel_themes(self):
     y = '''
      - buildings:
         types: 
         - polygons
         select:
         - building
     '''
     m, errors = Mapping.validate(y)
     self.assertTrue(m is None)
     self.assertTrue(len(errors) == 1)
示例#4
0
 def test_invalid_yaml_parse(self):
     y = '''
     buildings:
        - types: 
          - polygons
       select:
         - building
     '''
     m, errors = Mapping.validate(y)
     self.assertTrue(m is None)
     self.assertTrue(len(errors) == 1)
示例#5
0
 def test_wrong_yaml_parse(self):
     y = '''
     buildings:
       - types: 
         - polygons
       - select:
         - building
     '''
     m, errors = Mapping.validate(y)
     self.assertTrue(m is None)
     self.assertTrue(len(errors) == 1)
     self.assertTrue('must be YAML dict' in errors[0])
示例#6
0
 def test_invalid_sql(self):
     y = '''
     buildings:
       types:
         - polygons
       select:
         - building
       where: XXX aaa
     '''
     m, errors = Mapping.validate(y)
     self.assertTrue(m is None)
     self.assertTrue(len(errors) == 1)
示例#7
0
def validate_feature_selection(value):
    from osm_export_tool.mapping import Mapping
    m, errors = Mapping.validate(value)
    if not m:
        raise ValidationError(errors)
示例#8
0
 def test_empty_yaml(self):
     y = '''
     '''
     m, errors = Mapping.validate(y)
     self.assertTrue(m is None)
     self.assertTrue(len(errors) == 1)