summaryrefslogtreecommitdiffstats
path: root/tests/tz/test_helpers.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-01-05 10:38:34 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-01-05 10:38:34 +0000
commite3bdad36cc3a1a00c1e6772ca1c1898085ab73e0 (patch)
tree34512072a667ae716fd262e7b37e733e60fe4d89 /tests/tz/test_helpers.py
parentAdding upstream version 2.1.2. (diff)
downloadpendulum-e3bdad36cc3a1a00c1e6772ca1c1898085ab73e0.tar.xz
pendulum-e3bdad36cc3a1a00c1e6772ca1c1898085ab73e0.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/tz/test_helpers.py')
-rw-r--r--tests/tz/test_helpers.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/tz/test_helpers.py b/tests/tz/test_helpers.py
new file mode 100644
index 0000000..edec6fd
--- /dev/null
+++ b/tests/tz/test_helpers.py
@@ -0,0 +1,27 @@
+from __future__ import annotations
+
+import pytest
+
+from pendulum.tz import timezone
+from pendulum.tz.exceptions import InvalidTimezone
+from pendulum.tz.timezone import FixedTimezone
+from pendulum.tz.timezone import Timezone
+
+
+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"