Testing Data Source Features.
(self)
| 249 | self.assertEqual(str(lyr[0]["str"]), "1") |
| 250 | |
| 251 | def test04_features(self): |
| 252 | "Testing Data Source Features." |
| 253 | for source in ds_list: |
| 254 | ds = DataSource(source.ds) |
| 255 | |
| 256 | # Incrementing through each layer |
| 257 | for layer in ds: |
| 258 | # Incrementing through each feature in the layer |
| 259 | for feat in layer: |
| 260 | # Making sure the number of fields, and the geometry type |
| 261 | # are what's expected. |
| 262 | self.assertEqual(source.nfld, len(list(feat))) |
| 263 | self.assertEqual(source.gtype, feat.geom_type) |
| 264 | |
| 265 | # Making sure the fields match to an appropriate OFT type. |
| 266 | for k, v in source.fields.items(): |
| 267 | # Making sure we get the proper OGR Field instance, |
| 268 | # using a string value index for the feature. |
| 269 | self.assertIsInstance(feat[k], v) |
| 270 | self.assertIsInstance(feat.fields[0], str) |
| 271 | |
| 272 | # Testing Feature.__iter__ |
| 273 | for fld in feat: |
| 274 | self.assertIn(fld.name, source.fields) |
| 275 | |
| 276 | def test05_geometries(self): |
| 277 | "Testing Geometries from Data Source Features." |
nothing calls this directly
no test coverage detected