Skip to content

Commit

Permalink
Skip test if GDAL < 3.6
Browse files Browse the repository at this point in the history
  • Loading branch information
sgillies committed Sep 23, 2024
1 parent 0a989a6 commit 3a7991b
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions tests/test_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ def test_feature_encode():
assert o_dict["id"] == "foo"
assert o_dict["geometry"]["type"] == "Point"
assert o_dict["geometry"]["coordinates"] == (0, 0)
assert o_dict["properties"]["bytes"] == b'3031323334'
assert o_dict["properties"]["bytes"] == b"3031323334"


def test_decode_object_hook():
Expand Down Expand Up @@ -313,7 +313,7 @@ def test_feature_gi():

def test_encode_bytes():
"""Bytes are encoded using base64."""
assert ObjectEncoder().default(b"01234") == b'3031323334'
assert ObjectEncoder().default(b"01234") == b"3031323334"


def test_null_property_encoding():
Expand Down Expand Up @@ -342,7 +342,10 @@ def test_feature_repr():
geometry=Geometry(type="LineString", coordinates=[(0, 0)] * 100),
properties=Properties(a=1, foo="bar"),
)
assert repr(feat) == "fiona.Feature(geometry=fiona.Geometry(coordinates=[(0, 0), ...], type='LineString'), id='1', properties=fiona.Properties(a=1, foo='bar'))"
assert (
repr(feat)
== "fiona.Feature(geometry=fiona.Geometry(coordinates=[(0, 0), ...], type='LineString'), id='1', properties=fiona.Properties(a=1, foo='bar'))"
)


def test_issue1430():
Expand All @@ -354,6 +357,9 @@ def test_issue1430():
assert feat.properties["foo"] == "bar"


@pytest.mark.skipif(
not gdal_version.at_least("3.6"), reason="Requires at least GDAL 3.6"
)
def test_issue1451():
"""Report when a JSON property can't be decoded."""
with fiona.open("tests/data/issue1451.geojson") as collection:
Expand All @@ -363,4 +369,6 @@ def test_issue1451():
first, second = list(collection)
assert first.properties["country_code"].startswith("String(JSON)")
assert "val=b'0583'" in first.properties["country_code"]
assert "Extra data: line 1 column 2 (char 1)" in first.properties["country_code"]
assert (
"Extra data: line 1 column 2 (char 1)" in first.properties["country_code"]
)

0 comments on commit 3a7991b

Please sign in to comment.