'Testing LayerMapping initialization.'

def test_init(self):

    bad1 = copy(city_mapping)
    bad1[u'foobar'] = u'FooField'
    bad2 = copy(city_mapping)
    bad2[u'name'] = u'Nombre'
    bad3 = copy(city_mapping)
    bad3[u'point'] = u'CURVE'
    for bad_map in (bad1, bad2, bad3):
        with self.assertRaises(LayerMapError):
            lm = LayerMapping(City, city_shp, bad_map)
    with self.assertRaises(LookupError):
        lm = LayerMapping(City, city_shp, city_mapping, encoding=u'foobar')
