File: test_hashing.py

package info (click to toggle)
pendulum 3.1.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,780 kB
  • sloc: python: 18,420; makefile: 41
file content (23 lines) | stat: -rw-r--r-- 649 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from __future__ import annotations

import pendulum


def test_intervals_with_same_duration_and_different_dates():
    day1 = pendulum.DateTime(2018, 1, 1)
    day2 = pendulum.DateTime(2018, 1, 2)
    day3 = pendulum.DateTime(2018, 1, 2)

    interval1 = day2 - day1
    interval2 = day3 - day2

    assert interval1 != interval2
    assert len({interval1, interval2}) == 2


def test_intervals_with_same_dates():
    interval1 = pendulum.DateTime(2018, 1, 2) - pendulum.DateTime(2018, 1, 1)
    interval2 = pendulum.DateTime(2018, 1, 2) - pendulum.DateTime(2018, 1, 1)

    assert interval1 == interval2
    assert len({interval1, interval2}) == 1