diff options
Diffstat (limited to '')
-rw-r--r-- | tests/tz/test_helpers.py | 25 |
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" |