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/tz/test_helpers.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 '')
-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" |