Skip to content

Commit cce839f

Browse files
Fix off-by-one error in version parsing function msg. (#286)
* Fix off-by-one error in version parsing function msg. * Update pins/tests/test_versions.py
1 parent 91e471e commit cce839f

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

pins/tests/test_versions.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,20 @@ def test_version_from_string():
2121
assert version.hash == "baf3f"
2222

2323

24+
def test_version_from_string_too_many_hyphens():
25+
with pytest.raises(
26+
PinsVersionError, match="version string can only have 1 '-', but contains 2"
27+
):
28+
Version.from_string("20220209T220116Z-baf3f-")
29+
30+
31+
def test_version_from_string_too_few_hyphens():
32+
with pytest.raises(
33+
PinsVersionError, match="version string can only have 1 '-', but contains 0"
34+
):
35+
Version.from_string("20220209T220116Zbaf3f")
36+
37+
2438
def test_version_from_string_baddate():
2539
with pytest.raises(PinsVersionError, match="Invalid date part of version: bug"):
2640
Version.from_string("bug-baf3f")

0 commit comments

Comments
 (0)