diff --git a/pins/tests/test_versions.py b/pins/tests/test_versions.py index bb648ee..6432108 100644 --- a/pins/tests/test_versions.py +++ b/pins/tests/test_versions.py @@ -21,6 +21,20 @@ def test_version_from_string(): assert version.hash == "baf3f" +def test_version_from_string_too_many_hyphens(): + with pytest.raises( + PinsVersionError, match="version string can only have 1 '-', but contains 2" + ): + Version.from_string("20220209T220116Z-baf3f-") + + +def test_version_from_string_too_few_hyphens(): + with pytest.raises( + PinsVersionError, match="version string can only have 1 '-', but contains 0" + ): + Version.from_string("20220209T220116Zbaf3f") + + def test_version_from_string_baddate(): with pytest.raises(PinsVersionError, match="Invalid date part of version: bug"): Version.from_string("bug-baf3f")