diff --git a/test_maya.py b/test_maya.py index 8406b6c..649b495 100644 --- a/test_maya.py +++ b/test_maya.py @@ -1,3 +1,6 @@ +import pytest +from datetime import datetime + import maya @@ -43,10 +46,29 @@ def test_dt_tz_naive(): def test_random_date(): - d = maya.when('11-17-11') + d = maya.when('11-17-11 08:09:10') assert d.year == 2011 assert d.month == 11 assert d.day == 17 + assert d.hour == 8 + assert d.minute == 9 + assert d.second == 10 + assert d.microsecond == 0 + + +def test_print_date(capsys): + d = maya.when('11-17-11') + + print(d) + out, err = capsys.readouterr() + assert out == '\n' + + assert type(d.__format__()) is datetime + + +def test_invalid_date(): + with pytest.raises(ValueError): + d = maya.when('another day') def test_slang_date():