summaryrefslogtreecommitdiffstats
path: root/tests/tz/test_helpers.py
diff options
context:
space:
mode:
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"