Skip to content

Commit

Permalink
chore: Add explicit test for int-value in ULID.from_timestamp
Browse files Browse the repository at this point in the history
  • Loading branch information
mdomke committed Mar 19, 2024
1 parent 90b955e commit 30e653d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tests/test_ulid.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ def test_hash() -> None:
@freeze_time()
def test_ulid_from_time() -> None:
ulid1 = ULID.from_timestamp(time.time())
ulid2 = ULID.from_datetime(utcnow())
ulid2 = ULID.from_timestamp(time.time_ns() // 1000000)
ulid3 = ULID.from_datetime(utcnow())

now = utcnow()
t = time.time()
Expand All @@ -126,6 +127,9 @@ def test_ulid_from_time() -> None:
assert ulid2.timestamp == pytest.approx(t)
datetimes_almost_equal(ulid2.datetime, now)

assert ulid2.timestamp == pytest.approx(t)
datetimes_almost_equal(ulid3.datetime, now)


@freeze_time()
def test_ulid_from_timestamp() -> None:
Expand Down

0 comments on commit 30e653d

Please sign in to comment.