Skip to content

Commit

Permalink
Merge pull request #2 from iron3oxide/update-typeid-checks-for-prefix…
Browse files Browse the repository at this point in the history
…-invalid-exception

Update typeid checks for prefix invalid exception
  • Loading branch information
iron3oxide authored May 14, 2024
2 parents c6a4611 + 76f185b commit 40b31c2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tests/test_typeid.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import uuid6

from typeid import TypeID
from typeid.errors import InvalidTypeIDStringException
from typeid.errors import SuffixValidationException


def test_default_suffix() -> None:
Expand Down Expand Up @@ -87,7 +87,7 @@ def test_construct_type_from_string_with_prefix_standalone() -> None:
def test_construct_type_from_invalid_string() -> None:
string = "invalid_string_to_typeid"

with pytest.raises(InvalidTypeIDStringException):
with pytest.raises(SuffixValidationException):
TypeID.from_string(string)


Expand Down
2 changes: 2 additions & 0 deletions typeid/typeid.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ def get_prefix_and_suffix(string: str) -> tuple:
if len(parts) == 1:
prefix = None
suffix = parts[0]
elif len(parts) == 2 and parts[0] == "":
raise InvalidTypeIDStringException(f"Invalid TypeID: {string}")
else:
prefix, suffix = parts

Expand Down

0 comments on commit 40b31c2

Please sign in to comment.