diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-01-05 10:38:34 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-01-05 10:38:34 +0000 |
commit | e3bdad36cc3a1a00c1e6772ca1c1898085ab73e0 (patch) | |
tree | 34512072a667ae716fd262e7b37e733e60fe4d89 /tests/helpers/test_local_time.py | |
parent | Adding upstream version 2.1.2. (diff) | |
download | pendulum-upstream/3.0.0_a1.tar.xz pendulum-upstream/3.0.0_a1.zip |
Adding upstream version 3.0.0~a1.upstream/3.0.0_a1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/helpers/test_local_time.py')
-rw-r--r-- | tests/helpers/test_local_time.py | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/helpers/test_local_time.py b/tests/helpers/test_local_time.py new file mode 100644 index 0000000..0563107 --- /dev/null +++ b/tests/helpers/test_local_time.py @@ -0,0 +1,31 @@ +from __future__ import annotations + +import pendulum + +from pendulum.helpers import local_time + + +def test_local_time_positive_integer(): + d = pendulum.datetime(2016, 8, 7, 12, 34, 56, 123456) + + t = local_time(d.int_timestamp, 0, d.microsecond) + assert d.year == t[0] + assert d.month == t[1] + assert d.day == t[2] + assert d.hour == t[3] + assert d.minute == t[4] + assert d.second == t[5] + assert d.microsecond == t[6] + + +def test_local_time_negative_integer(): + d = pendulum.datetime(1951, 8, 7, 12, 34, 56, 123456) + + t = local_time(d.int_timestamp, 0, d.microsecond) + assert d.year == t[0] + assert d.month == t[1] + assert d.day == t[2] + assert d.hour == t[3] + assert d.minute == t[4] + assert d.second == t[5] + assert d.microsecond == t[6] |