Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/geopins/drivers/gdf/filetypes/gpkg.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ def pin_write_gdf_gpkg( # noqa: PLR0913
versioned: Whether the pin should be versioned. Defaults to versioning.
created: A date to store in the Meta.created field. This field may be used
as part of the pin version name.
force_identical_write: Store the pin even if the pin contents are identical
to the last version (compared using the hash). Only
the pin contents are compared, not the pin metadata.
Defaults to False.
force_identical_write: Not supported. Store the pin even if the pin contents
are identical to the last version (compared using
the hash). Only the pin contents are compared, not
the pin metadata. Defaults to False.
board: The (geo)pins board to write to.

Returns:
Expand Down
8 changes: 4 additions & 4 deletions src/geopins/drivers/gdf/filetypes/parquet.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,10 @@ def pin_write_gdf_parquet( # noqa: PLR0913
versioned: Whether the pin should be versioned. Defaults to versioning.
created: A date to store in the Meta.created field. This field may be used
as part of the pin version name.
force_identical_write: Store the pin even if the pin contents are identical
to the last version (compared using the hash). Only
the pin contents are compared, not the pin metadata.
Defaults to False.
force_identical_write: Not supported. Store the pin even if the pin contents
are identical to the last version (compared using
the hash). Only the pin contents are compared, not
the pin metadata. Defaults to False.
board: The (geo)pins board to write to.

Returns:
Expand Down
16 changes: 16 additions & 0 deletions tests/geopins/drivers/gdf/filetypes/test_gpkg.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from typing import TYPE_CHECKING

import geopandas as gpd
import pytest
from pins.meta import Meta

from geopins.boards import GeoBaseBoard
Expand Down Expand Up @@ -45,3 +46,18 @@ def test_hash_is_not_dependent_on_file_write_time(tmp_geoboard: GeoBaseBoard):

# Assert
assert meta1.pin_hash == meta2.pin_hash


def test_force_identical_write_raises(tmp_geoboard: GeoBaseBoard):
# Arrange
gdf = gpd.GeoDataFrame(
{"id": [1, 2, 3]},
geometry=gpd.points_from_xy([0, 1, 2], [0, 1, 2]),
crs="EPSG:2193",
)

# Act / Assert
with pytest.raises(NotImplementedError, match="force_identical_write=True"):
tmp_geoboard.pin_write(
gdf, name="test-gdf", type="gpkg", force_identical_write=True
)
16 changes: 16 additions & 0 deletions tests/geopins/drivers/gdf/filetypes/test_parquet.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from typing import TYPE_CHECKING

import geopandas as gpd
import pytest
from pins.meta import Meta

from geopins.boards import GeoBaseBoard
Expand All @@ -26,3 +27,18 @@ def test_round_trip(tmp_geoboard: GeoBaseBoard):

# Assert
assert gdf.equals(retrieved)


def test_force_identical_write_raises(tmp_geoboard: GeoBaseBoard):
# Arrange
gdf = gpd.GeoDataFrame(
{"id": [1, 2, 3]},
geometry=gpd.points_from_xy([0, 1, 2], [0, 1, 2]),
crs="EPSG:4326",
)

# Act / Assert
with pytest.raises(NotImplementedError, match="force_identical_write=True"):
tmp_geoboard.pin_write(
gdf, name="test-gdf", type="parquet", force_identical_write=True
)
12 changes: 12 additions & 0 deletions tests/geopins/drivers/raster/filetypes/test_tif.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from typing import TYPE_CHECKING

import pytest
from pins.meta import Meta
from rastr.raster import Raster

Expand All @@ -22,3 +23,14 @@ def test_round_trip(tmp_geoboard: GeoBaseBoard):

# Assert
assert raster == retrieved


def test_force_identical_write_raises(tmp_geoboard: GeoBaseBoard):
# Arrange
raster = Raster.example()

# Act / Assert
with pytest.raises(NotImplementedError, match="force_identical_write=True"):
tmp_geoboard.pin_write(
raster, name="test-raster", type="tif", force_identical_write=True
)