|
1 | 1 | from geojson_pydantic.geometries import ( |
| 2 | + GeometryCollection, |
2 | 3 | LineString, |
3 | 4 | MultiLineString, |
4 | 5 | MultiPoint, |
5 | 6 | MultiPolygon, |
6 | 7 | Point, |
7 | 8 | Polygon, |
| 9 | + _GeometryBase, |
8 | 10 | ) |
9 | 11 | from geojson_pydantic.types import Position, Position2D, Position3D |
10 | 12 |
|
@@ -362,3 +364,39 @@ def test_multi_polygon3d(): |
362 | 364 | assert isinstance(coordinates.longitude, float) |
363 | 365 | assert isinstance(coordinates.latitude, float) |
364 | 366 | assert isinstance(coordinates.altitude, float) |
| 367 | + |
| 368 | + |
| 369 | +def test_geometry_collection(): |
| 370 | + geojson_faker = GeoJsonFaker() |
| 371 | + geometry_collection = geojson_faker.geometry_collection |
| 372 | + |
| 373 | + assert isinstance(geometry_collection, GeometryCollection) |
| 374 | + assert geometry_collection.type == "GeometryCollection" |
| 375 | + assert len(geometry_collection.geometries) > 0 |
| 376 | + |
| 377 | + for geometry in geometry_collection.geometries: |
| 378 | + assert isinstance(geometry, _GeometryBase) |
| 379 | + |
| 380 | + |
| 381 | +def test_geometry_collection2d(): |
| 382 | + geojson_faker = GeoJsonFaker() |
| 383 | + geometry_collection = geojson_faker.geometry_collection2d |
| 384 | + |
| 385 | + assert isinstance(geometry_collection, GeometryCollection) |
| 386 | + assert geometry_collection.type == "GeometryCollection" |
| 387 | + assert len(geometry_collection.geometries) > 0 |
| 388 | + |
| 389 | + for geometry in geometry_collection.geometries: |
| 390 | + assert isinstance(geometry, _GeometryBase) |
| 391 | + |
| 392 | + |
| 393 | +def test_geometry_collection3d(): |
| 394 | + geojson_faker = GeoJsonFaker() |
| 395 | + geometry_collection = geojson_faker.geometry_collection3d |
| 396 | + |
| 397 | + assert isinstance(geometry_collection, GeometryCollection) |
| 398 | + assert geometry_collection.type == "GeometryCollection" |
| 399 | + assert len(geometry_collection.geometries) > 0 |
| 400 | + |
| 401 | + for geometry in geometry_collection.geometries: |
| 402 | + assert isinstance(geometry, _GeometryBase) |
0 commit comments