summaryrefslogtreecommitdiffstats
path: root/tests/helpers/test_local_time.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2021-01-30 07:57:29 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2021-01-30 07:57:29 +0000
commita003430ded2dbfbfb48acd3c17f143cbafeee60a (patch)
tree9016b0b904b32c46542f48de704b3e536b90e1af /tests/helpers/test_local_time.py
parentInitial commit. (diff)
downloadpendulum-a003430ded2dbfbfb48acd3c17f143cbafeee60a.tar.xz
pendulum-a003430ded2dbfbfb48acd3c17f143cbafeee60a.zip
Adding upstream version 2.1.2.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--tests/helpers/test_local_time.py29
1 files changed, 29 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..a9afbd0
--- /dev/null
+++ b/tests/helpers/test_local_time.py
@@ -0,0 +1,29 @@
+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]