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/time/test_behavior.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 'tests/time/test_behavior.py')
-rw-r--r-- | tests/time/test_behavior.py | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/tests/time/test_behavior.py b/tests/time/test_behavior.py new file mode 100644 index 0000000..4296434 --- /dev/null +++ b/tests/time/test_behavior.py @@ -0,0 +1,46 @@ +import pickle + +from datetime import time + +import pendulum +import pytest + +from pendulum import Time + + +@pytest.fixture() +def p(): + return pendulum.Time(12, 34, 56, 123456, tzinfo=pendulum.timezone("Europe/Paris")) + + +@pytest.fixture() +def d(): + return time(12, 34, 56, 123456, tzinfo=pendulum.timezone("Europe/Paris")) + + +def test_hash(p, d): + assert hash(d) == hash(p) + dt1 = Time(12, 34, 57, 123456) + + assert hash(p) != hash(dt1) + + +def test_pickle(): + dt1 = Time(12, 34, 56, 123456) + s = pickle.dumps(dt1) + dt2 = pickle.loads(s) + + assert dt2 == dt1 + + +def test_utcoffset(p, d): + assert d.utcoffset() == p.utcoffset() + + +def test_dst(p, d): + assert d.dst() == p.dst() + + +def test_tzname(p, d): + assert d.tzname() == p.tzname() + assert Time(12, 34, 56, 123456).tzname() == time(12, 34, 56, 123456).tzname() |