'Test LayerMapping import of a simple point shapefile.'

def test_simple_layermap(self):

    lm = LayerMapping(City, city_shp, city_mapping)
    lm.save()
    self.assertEqual(3, City.objects.count())
    ds = DataSource(city_shp)
    layer = ds[0]
    for feat in layer:
        city = City.objects.get(name=feat['Name'].value)
        self.assertEqual(feat['Population'].value, city.population)
        self.assertEqual(Decimal(str(feat['Density'])), city.density)
        self.assertEqual(feat['Created'].value, city.dt)
        (pnt1, pnt2) = (feat.geom, city.point)
        self.assertAlmostEqual(pnt1.x, pnt2.x, 5)
        self.assertAlmostEqual(pnt1.y, pnt2.y, 5)
