Just add some tests to have full coverage

Now it's 💯 % coverage, i don't if it's good or bad but it was easy :)
This commit is contained in:
Grigouze
2016-12-18 13:24:58 +01:00
parent 59064a5c50
commit c46d9874d4
+23 -1
View File
@@ -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 == '<MayaDT epoch=1321488000.0>\n'
assert type(d.__format__()) is datetime
def test_invalid_date():
with pytest.raises(ValueError):
d = maya.when('another day')
def test_slang_date():