Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
thatstoasty committed Dec 14, 2024
1 parent c7bf971 commit dc28a33
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions test/test_small_time.mojo
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,23 @@ def assert_datetime_equal(dt: SmallTime, py_dt: PythonObject):
)


# TODO: Commented out non deterministic tests for now.
# def test_now():
# var result = now()
# assert_datetime_equal(result, py_dt_datetime().now())
def test_now():
assert_datetime_equal(now(), py_dt_datetime().now())


# def test_utc_now():
# var result = now(utc=True)
# assert_datetime_equal(result, py_dt_datetime().utcnow())
def test_utc_now():
var result = now(utc=True)
assert_datetime_equal(result, py_dt_datetime().utcnow())


# def test_from_timestamp():
# var t = c.gettimeofday()
# var result = from_timestamp(t.tv_sec)
# assert_datetime_equal(result, py_dt_datetime().now())
def test_from_timestamp():
var t = c.gettimeofday()
var result = from_timestamp(t.tv_sec)
assert_datetime_equal(result, py_dt_datetime().now())

# t = c.gettimeofday()
# result = from_timestamp(t.tv_sec, True)
# assert_datetime_equal(result, py_dt_datetime().utcnow())
t = c.gettimeofday()
result = from_timestamp(t.tv_sec, utc=True)
assert_datetime_equal(result, py_dt_datetime().utcnow())


def test_iso_format():
Expand Down

0 comments on commit dc28a33

Please sign in to comment.