123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153 |
- import icalendar.cal
- import pytest
- import ical2vdir
- @pytest.mark.parametrize(
- ("event_a_ical", "event_b_ical", "expected_result"),
- (
- [
- (
- """BEGIN:VEVENT
- SUMMARY:party
- DTSTART:20201024T100000Z
- DTEND:20201026T120000Z
- DTSTAMP:20200205T160640Z
- UID:123456789@google.com
- SEQUENCE:0
- CREATED:20191231T103841Z
- DESCRIPTION:
- LAST-MODIFIED:20191231T103841Z
- LOCATION:
- STATUS:CONFIRMED
- TRANSP:OPAQUE
- END:VEVENT
- """,
- """BEGIN:VEVENT
- SUMMARY:party
- DTSTART:20201024T100000Z
- DTEND:20201026T120000Z
- DTSTAMP:20200205T160640Z
- UID:123456789@google.com
- SEQUENCE:0
- CREATED:20191231T103841Z
- DESCRIPTION:
- LAST-MODIFIED:20191231T103841Z
- LOCATION:
- STATUS:CONFIRMED
- TRANSP:OPAQUE
- END:VEVENT
- """,
- True,
- ),
- (
- """BEGIN:VEVENT
- SUMMARY:party
- DTSTART:20201024T100000Z
- DTEND:20201026T120000Z
- DTSTAMP:20200205T160640Z
- UID:123456789@google.com
- SEQUENCE:0
- CREATED:20191231T103841Z
- DESCRIPTION:
- LAST-MODIFIED:20191231T103841Z
- LOCATION:
- STATUS:CONFIRMED
- TRANSP:OPAQUE
- END:VEVENT
- """,
- """BEGIN:VEVENT
- SUMMARY:party
- DTSTART:20201024T100000Z
- DTEND:20201026T120000Z
- DTSTAMP:20200205T160640Z
- UID:123456789@google.com
- SEQUENCE:0
- CREATED:20191231T103841Z
- DESCRIPTION:
- LAST-MODIFIED:20191231T103841Z
- STATUS:CONFIRMED
- TRANSP:OPAQUE
- END:VEVENT
- """,
- False,
- ),
- (
- """BEGIN:VEVENT
- SUMMARY:party
- DTSTART:20201024T100000Z
- DTEND:20201026T120000Z
- DTSTAMP:20200205T160640Z
- UID:123456789@google.com
- SEQUENCE:0
- CREATED:20191231T103841Z
- LAST-MODIFIED:20191231T103841Z
- END:VEVENT
- """,
- """BEGIN:VEVENT
- SUMMARY:party
- DTSTART:20201024T100000Z
- DTEND:20201026T120000Z
- DTSTAMP:20200205T160640Z
- UID:123456789@google.com
- SEQUENCE:1
- CREATED:20191231T103841Z
- LAST-MODIFIED:20191231T103841Z
- END:VEVENT
- """,
- False,
- ),
- (
- """BEGIN:VEVENT
- SUMMARY:party
- DTSTART:20201024T100000Z
- DTEND:20201026T120000Z
- DTSTAMP:20200205T160640Z
- UID:123456789@google.com
- SEQUENCE:0
- CREATED:20191231T103841Z
- LAST-MODIFIED:20191231T103841Z
- END:VEVENT
- """,
-
- """BEGIN:VEVENT
- SUMMARY:party
- DTSTART:20201024T100000Z
- DTEND:20201026T120000Z
- DTSTAMP:20200205T200640Z
- UID:123456789@google.com
- SEQUENCE:0
- CREATED:20191231T103841Z
- LAST-MODIFIED:20191231T103841Z
- END:VEVENT
- """,
- True,
- ),
- ]
- ),
- )
- def test__events_equal(
- event_a_ical: str, event_b_ical: str, expected_result: bool
- ) -> None:
- event_a = icalendar.cal.Event.from_ical(event_a_ical)
- event_b = icalendar.cal.Event.from_ical(event_b_ical)
-
- assert ical2vdir._events_equal(event_a, event_b) == expected_result
|