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/period/test_hashing.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/period/test_hashing.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/period/test_hashing.py b/tests/period/test_hashing.py new file mode 100644 index 0000000..2a567f1 --- /dev/null +++ b/tests/period/test_hashing.py @@ -0,0 +1,21 @@ +import pendulum + + +def test_periods_with_same_duration_and_different_dates(): + day1 = pendulum.DateTime(2018, 1, 1) + day2 = pendulum.DateTime(2018, 1, 2) + day3 = pendulum.DateTime(2018, 1, 2) + + period1 = day2 - day1 + period2 = day3 - day2 + + assert period1 != period2 + assert len({period1, period2}) == 2 + + +def test_periods_with_same_dates(): + period1 = pendulum.DateTime(2018, 1, 2) - pendulum.DateTime(2018, 1, 1) + period2 = pendulum.DateTime(2018, 1, 2) - pendulum.DateTime(2018, 1, 1) + + assert period1 == period2 + assert len({period1, period2}) == 1 |