From d6d80a17444c90259c5bfdacb84c61e6bfece655 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Thu, 5 Jan 2023 11:38:41 +0100 Subject: Merging upstream version 3.0.0~a1. Signed-off-by: Daniel Baumann --- tests/duration/test_total_methods.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 tests/duration/test_total_methods.py (limited to 'tests/duration/test_total_methods.py') diff --git a/tests/duration/test_total_methods.py b/tests/duration/test_total_methods.py new file mode 100644 index 0000000..aabcd6c --- /dev/null +++ b/tests/duration/test_total_methods.py @@ -0,0 +1,28 @@ +from __future__ import annotations + +import pendulum + + +def test_in_weeks(): + it = pendulum.duration(days=17) + assert round(it.total_weeks(), 2) == 2.43 + + +def test_in_days(): + it = pendulum.duration(days=3) + assert it.total_days() == 3 + + +def test_in_hours(): + it = pendulum.duration(days=3, minutes=72) + assert it.total_hours() == 73.2 + + +def test_in_minutes(): + it = pendulum.duration(minutes=6, seconds=72) + assert it.total_minutes() == 7.2 + + +def test_in_seconds(): + it = pendulum.duration(seconds=72, microseconds=123456) + assert it.total_seconds() == 72.123456 -- cgit v1.2.3