'Testing the `unique`, and `transform`, geometry collection conversion, and ForeignKey mappings.'

def test04_layermap_unique_multigeometry_fk(self):

    try:
        lm = LayerMapping(County, co_shp, co_mapping, transform=False)
        lm = LayerMapping(County, co_shp, co_mapping, source_srs=4269)
        lm = LayerMapping(County, co_shp, co_mapping, source_srs='NAD83')
        for arg in ('name', ('name', 'mpoly')):
            lm = LayerMapping(County, co_shp, co_mapping, transform=False, unique=arg)
    except:
        self.fail('No    exception    should    be    raised    for    proper    use    of    keywords.')
    for (e, arg) in ((TypeError, 5.0), (ValueError, 'foobar'), (ValueError, ('name', 'mpolygon'))):
        self.assertRaises(e, LayerMapping, County, co_shp, co_mapping, transform=False, unique=arg)
    if (not mysql):
        self.assertRaises(LayerMapError, LayerMapping, County, co_shp, co_mapping)
    bad_fk_map1 = copy(co_mapping)
    bad_fk_map1['state'] = 'name'
    bad_fk_map2 = copy(co_mapping)
    bad_fk_map2['state'] = {'nombre': 'State'}
    self.assertRaises(TypeError, LayerMapping, County, co_shp, bad_fk_map1, transform=False)
    self.assertRaises(LayerMapError, LayerMapping, County, co_shp, bad_fk_map2, transform=False)
    lm = LayerMapping(County, co_shp, co_mapping, transform=False, unique='name')
    self.assertRaises(MissingForeignKey, lm.save, silent=True, strict=True)
    (co, hi, tx) = (State(name='Colorado'), State(name='Hawaii'), State(name='Texas'))
    (co.save(), hi.save(), tx.save())
    lm = LayerMapping(County, co_shp, co_mapping, transform=False, unique='name')
    lm.save(silent=True, strict=True)
    lm = LayerMapping(CountyFeat, co_shp, cofeat_mapping, transform=False)
    lm.save(silent=True, strict=True)
    self.county_helper()
