From 9450ec9ff39dfe927d9e08adcaf76679daf0ed06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=20H=C3=B6ren?= Date: Tue, 23 Feb 2021 02:22:11 +0100 Subject: [PATCH] added some more tests --- tests/test_DT.py | 8 ++++++++ tests/test_TD.py | 7 +++++++ 2 files changed, 15 insertions(+) diff --git a/tests/test_DT.py b/tests/test_DT.py index 4bbb023..8efac35 100644 --- a/tests/test_DT.py +++ b/tests/test_DT.py @@ -81,6 +81,13 @@ def test_init_str_invalid(): assert True else: assert False + + try: + DT(('fubar',)) + except DTError: + assert True + else: + assert False def test_populate(): @@ -264,3 +271,4 @@ def test__ge__(): def test__str__(): assert True + diff --git a/tests/test_TD.py b/tests/test_TD.py index 09bb206..2197319 100644 --- a/tests/test_TD.py +++ b/tests/test_TD.py @@ -17,3 +17,10 @@ assert TD(one).__str__() == "1 year 1 month 1 week 1 day 1 hour 1 minute 1 second" assert TD(two).__str__() == "2 years 2 months 2 weeks 2 days 2 hours 2 minutes 2 seconds" +assert TD(one).seconds() == one +assert TD(one).minutes() == 580981.0166666667 +assert TD(one).hours() == 9683.016944444444 +assert TD(one).days() == 403.45903935185186 +assert TD(one).weeks() == 57.63700562169312 +assert TD(one).months() == 13.264406773211567 +assert TD(one).years() == 1.105367231100964