Testing valid SHP Data Source files.
(self)
| 113 | |
| 114 | class DataSourceTest(SimpleTestCase): |
| 115 | def test01_valid_shp(self): |
| 116 | "Testing valid SHP Data Source files." |
| 117 | |
| 118 | for source in ds_list: |
| 119 | # Loading up the data source |
| 120 | ds = DataSource(source.ds) |
| 121 | |
| 122 | # The layer count is what's expected (only 1 layer in a SHP file). |
| 123 | self.assertEqual(1, len(ds)) |
| 124 | |
| 125 | # Making sure GetName works |
| 126 | self.assertEqual(source.ds, ds.name) |
| 127 | |
| 128 | # Making sure the driver name matches up |
| 129 | self.assertEqual(source.driver, str(ds.driver)) |
| 130 | |
| 131 | # Making sure indexing works |
| 132 | msg = "Index out of range when accessing layers in a datasource: %s." |
| 133 | with self.assertRaisesMessage(IndexError, msg % len(ds)): |
| 134 | ds.__getitem__(len(ds)) |
| 135 | |
| 136 | with self.assertRaisesMessage( |
| 137 | IndexError, "Invalid OGR layer name given: invalid." |
| 138 | ): |
| 139 | ds.__getitem__("invalid") |
| 140 | |
| 141 | def test_ds_input_pathlib(self): |
| 142 | test_shp = Path(get_ds_file("test_point", "shp")) |
nothing calls this directly
no test coverage detected