diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2021-01-30 07:57:29 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2021-01-30 07:57:29 +0000 |
commit | a003430ded2dbfbfb48acd3c17f143cbafeee60a (patch) | |
tree | 9016b0b904b32c46542f48de704b3e536b90e1af /tests/datetime/test_create_from_timestamp.py | |
parent | Initial commit. (diff) | |
download | pendulum-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 'tests/datetime/test_create_from_timestamp.py')
-rw-r--r-- | tests/datetime/test_create_from_timestamp.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/datetime/test_create_from_timestamp.py b/tests/datetime/test_create_from_timestamp.py new file mode 100644 index 0000000..e7e24d7 --- /dev/null +++ b/tests/datetime/test_create_from_timestamp.py @@ -0,0 +1,23 @@ +import pendulum + +from pendulum import timezone + +from ..conftest import assert_datetime + + +def test_create_from_timestamp_returns_pendulum(): + d = pendulum.from_timestamp(pendulum.datetime(1975, 5, 21, 22, 32, 5).timestamp()) + assert_datetime(d, 1975, 5, 21, 22, 32, 5) + assert d.timezone_name == "UTC" + + +def test_create_from_timestamp_with_timezone_string(): + d = pendulum.from_timestamp(0, "America/Toronto") + assert d.timezone_name == "America/Toronto" + assert_datetime(d, 1969, 12, 31, 19, 0, 0) + + +def test_create_from_timestamp_with_timezone(): + d = pendulum.from_timestamp(0, timezone("America/Toronto")) + assert d.timezone_name == "America/Toronto" + assert_datetime(d, 1969, 12, 31, 19, 0, 0) |