Skip to content

Commit d6e1da6

Browse files
committed
add test for semver
1 parent 9063fc3 commit d6e1da6

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

tests/geoh5py_test.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
# You should have received a copy of the GNU Lesser General Public License
1616
# along with geoh5py. If not, see <https://www.gnu.org/licenses/>.
1717

18+
import re
1819
from pathlib import Path
1920

2021
import toml
@@ -31,5 +32,15 @@ def get_version():
3132
return pyproject["tool"]["poetry"]["version"]
3233

3334

34-
def test_version():
35+
def test_version_is_consistent():
3536
assert geoh5py.__version__ == get_version()
37+
38+
39+
def test_version_is_semver():
40+
semver_re = (
41+
r"^(?P<major>0|[1-9]\d*)\.(?P<minor>0|[1-9]\d*)\.(?P<patch>0|[1-9]\d*)"
42+
r"(?:-(?P<prerelease>(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)"
43+
r"(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?"
44+
r"(?:\+(?P<buildmetadata>[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$"
45+
)
46+
assert re.search(semver_re, geoh5py.__version__) is not None

0 commit comments

Comments
 (0)