Testing LayerMapping initialization.
(self)
| 49 | |
| 50 | class LayerMapTest(TestCase): |
| 51 | def test_init(self): |
| 52 | "Testing LayerMapping initialization." |
| 53 | |
| 54 | # Model field that does not exist. |
| 55 | bad1 = copy(city_mapping) |
| 56 | bad1["foobar"] = "FooField" |
| 57 | |
| 58 | # Shapefile field that does not exist. |
| 59 | bad2 = copy(city_mapping) |
| 60 | bad2["name"] = "Nombre" |
| 61 | |
| 62 | # Nonexistent geographic field type. |
| 63 | bad3 = copy(city_mapping) |
| 64 | bad3["point"] = "CURVE" |
| 65 | |
| 66 | # Incrementing through the bad mapping dictionaries and |
| 67 | # ensuring that a LayerMapError is raised. |
| 68 | for bad_map in (bad1, bad2, bad3): |
| 69 | with self.assertRaises(LayerMapError): |
| 70 | LayerMapping(City, city_shp, bad_map) |
| 71 | |
| 72 | # A LookupError should be thrown for bogus encodings. |
| 73 | with self.assertRaises(LookupError): |
| 74 | LayerMapping(City, city_shp, city_mapping, encoding="foobar") |
| 75 | |
| 76 | def test_simple_layermap(self): |
| 77 | "Test LayerMapping import of a simple point shapefile." |
nothing calls this directly
no test coverage detected