summaryrefslogtreecommitdiffstats
path: root/tests/helpers/test_local_time.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/helpers/test_local_time.py')
-rw-r--r--tests/helpers/test_local_time.py31
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]