Skip to content

Commit

Permalink
TST: Handle GEOS version strings with dev / beta qualifiers in the te…
Browse files Browse the repository at this point in the history
…sts (#301)
  • Loading branch information
brendan-ward committed Feb 25, 2021
1 parent 64c4eca commit d7844ee
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions pygeos/test/test_misc.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from string import ascii_lowercase

import pygeos
from pygeos.decorators import requires_geos, multithreading_enabled
from unittest import mock
Expand All @@ -20,7 +22,12 @@ def test_version():

def test_geos_version():
expected = "{0:d}.{1:d}.{2:d}".format(*pygeos.geos_version)
assert pygeos.geos_version_string == expected
actual = pygeos.geos_version_string

# strip any beta / dev qualifiers
actual = actual.lower().rstrip(ascii_lowercase)

assert actual == expected


@pytest.mark.skipif(
Expand All @@ -31,7 +38,18 @@ def test_geos_capi_version():
expected = "{0:d}.{1:d}.{2:d}-CAPI-{3:d}.{4:d}.{5:d}".format(
*(pygeos.geos_version + pygeos.geos_capi_version)
)
assert pygeos.geos_capi_version_string == expected

# split into component parts and strip any beta / dev qualifiers
(
actual_geos_version,
actual_geos_api_version,
) = pygeos.geos_capi_version_string.split("-CAPI-")

actual_geos_version = actual_geos_version.lower().rstrip(ascii_lowercase)

assert (
"{0}-CAPI-{1}".format(actual_geos_version, actual_geos_api_version) == expected
)


@pytest.mark.parametrize("version", ["3.7.0", "3.7.1", "3.6.2"])
Expand Down

0 comments on commit d7844ee

Please sign in to comment.