summaryrefslogtreecommitdiffstats
path: root/tests/tz/test_helpers.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/tz/test_helpers.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 'tests/tz/test_helpers.py')
-rw-r--r--tests/tz/test_helpers.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/tz/test_helpers.py b/tests/tz/test_helpers.py
new file mode 100644
index 0000000..c8b8c92
--- /dev/null
+++ b/tests/tz/test_helpers.py
@@ -0,0 +1,25 @@
+import pytest
+
+from pendulum.tz import timezone
+from pendulum.tz.timezone import FixedTimezone
+from pendulum.tz.timezone import Timezone
+from pendulum.tz.zoneinfo.exceptions import InvalidTimezone
+
+
+def test_timezone_with_name():
+ tz = timezone("Europe/Paris")
+
+ assert isinstance(tz, Timezone)
+ assert tz.name == "Europe/Paris"
+
+
+def test_timezone_with_invalid_name():
+ with pytest.raises(InvalidTimezone):
+ timezone("Invalid")
+
+
+def test_timezone_with_offset():
+ tz = timezone(-19800)
+
+ assert isinstance(tz, FixedTimezone)
+ assert tz.name == "-05:30"