|
16 | 16 | vsi_listtree,
|
17 | 17 | vsi_unlink,
|
18 | 18 | )
|
19 |
| -from pyogrio._compat import GDAL_GE_352, HAS_ARROW_WRITE_API, HAS_PYPROJ, PANDAS_GE_15 |
| 19 | +from pyogrio._compat import ( |
| 20 | + GDAL_GE_37, |
| 21 | + GDAL_GE_352, |
| 22 | + HAS_ARROW_WRITE_API, |
| 23 | + HAS_PYPROJ, |
| 24 | + PANDAS_GE_15, |
| 25 | +) |
20 | 26 | from pyogrio.errors import DataLayerError, DataSourceError, FeatureError, GeometryError
|
21 | 27 | from pyogrio.geopandas import PANDAS_GE_20, read_dataframe, write_dataframe
|
22 | 28 | from pyogrio.raw import (
|
@@ -1580,6 +1586,30 @@ def test_custom_crs_io(tmp_path, naturalearth_lowres_all_ext, use_arrow):
|
1580 | 1586 | assert df.crs.equals(expected.crs)
|
1581 | 1587 |
|
1582 | 1588 |
|
| 1589 | +@pytest.mark.parametrize("ext", [".gpkg.zip", ".shp.zip", ".shz"]) |
| 1590 | +@pytest.mark.requires_arrow_write_api |
| 1591 | +def test_write_read_zipped_ext(tmp_path, naturalearth_lowres, ext, use_arrow): |
| 1592 | + """Run a basic read and write test on some extra (zipped) extensions.""" |
| 1593 | + if ext == ".gpkg.zip" and not GDAL_GE_37: |
| 1594 | + pytest.skip(".gpkg.zip support requires GDAL >= 3.7") |
| 1595 | + |
| 1596 | + input_gdf = read_dataframe(naturalearth_lowres) |
| 1597 | + output_path = tmp_path / f"test{ext}" |
| 1598 | + |
| 1599 | + write_dataframe(input_gdf, output_path, use_arrow=use_arrow) |
| 1600 | + |
| 1601 | + assert output_path.exists() |
| 1602 | + result_gdf = read_dataframe(output_path) |
| 1603 | + |
| 1604 | + geometry_types = result_gdf.geometry.type.unique() |
| 1605 | + if DRIVERS[ext] in DRIVERS_NO_MIXED_SINGLE_MULTI: |
| 1606 | + assert list(geometry_types) == ["MultiPolygon"] |
| 1607 | + else: |
| 1608 | + assert set(geometry_types) == {"MultiPolygon", "Polygon"} |
| 1609 | + |
| 1610 | + assert_geodataframe_equal(result_gdf, input_gdf, check_index_type=False) |
| 1611 | + |
| 1612 | + |
1583 | 1613 | def test_write_read_mixed_column_values(tmp_path):
|
1584 | 1614 | # use_arrow=True is tested separately below
|
1585 | 1615 | mixed_values = ["test", 1.0, 1, datetime.now(), None, np.nan]
|
|
0 commit comments