Skip to content

Commit

Permalink
uuid1 test
Browse files Browse the repository at this point in the history
  • Loading branch information
jmmshn committed Jan 18, 2024
1 parent e5cf7a6 commit 5430d0a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 0 additions & 2 deletions src/jobflow/utils/uuid.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ def get_timestamp_from_uuid(uuid: str) -> float:
funcs = {
"uuid1": _get_uuid_time_v1,
}
if id_type not in funcs:
raise ValueError(f"UUID type {id_type} not supported.")
return funcs[id_type](uuid)


Expand Down
10 changes: 9 additions & 1 deletion tests/test_uuid.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
import pytest


def test_uuid1():
from uuid import UUID

from jobflow.utils.uuid import get_timestamp_from_uuid, suuid

uuid = suuid("uuid1")
assert UUID(uuid).version == 1

assert isinstance(get_timestamp_from_uuid(uuid), float)

with pytest.raises(ValueError, match="UUID type uuid2 not supported."):
suuid("uuid2")

with pytest.raises(ValueError, match="ID type for FAKEUUID not recognized."):
get_timestamp_from_uuid("FAKEUUID")

0 comments on commit 5430d0a

Please sign in to comment.