File: test_daylight_saving_time.py

package info (click to toggle)
python-recurring-ical-events 3.3.3-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,128 kB
  • sloc: python: 2,896; sh: 15; makefile: 3
file content (28 lines) | stat: -rw-r--r-- 753 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
24
25
26
27
28
import datetime

import pytest
from pytz import timezone

berlin = timezone("Europe/Berlin")


@pytest.mark.parametrize(
    ("date", "time"),
    [
        (
            (2019, 3, 20),
            berlin.localize(datetime.datetime(2019, 3, 20, 19)),
        ),  # winter time, UTC+1
        (
            (2019, 4, 24),
            berlin.localize(datetime.datetime(2019, 4, 24, 19)),
        ),  # summer time UTC+2
    ],
)
def test_daylight_saving_events(calendars, date, time):
    """Test the event 7uartkcnhf0elbvs8md0itrf6c@google.com."""
    event = calendars.daylight_saving_time.at(date)[0]
    expected_time = calendars.consistent_tz(time)
    print(event["UID"])
    print(event["DTEND"].dt)
    assert event["DTSTART"].dt == expected_time