kopia lustrzana https://github.com/collective/icalendar
test Period overlaps
rodzic
b6c7eec9c2
commit
e86e6ff9ed
|
@ -9,7 +9,7 @@ import datetime
|
|||
|
||||
import pytest
|
||||
|
||||
from icalendar.prop import vDDDTypes
|
||||
from icalendar.prop import vDDDTypes, vPeriod
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
|
@ -95,3 +95,18 @@ def test_tzid_is_part_of_the_period_values(calendars, tzp):
|
|||
datetime.datetime(2023, 12, 13, 12), "America/Vancouver"
|
||||
)
|
||||
assert end == tzp.localize(datetime.datetime(2023, 12, 13, 15), "America/Vancouver")
|
||||
|
||||
|
||||
def test_period_overlaps():
|
||||
# 30 minute increments
|
||||
datetime_1 = datetime.datetime(2024, 11, 20, 12, 0) # 12:00
|
||||
datetime_2 = datetime.datetime(2024, 11, 20, 12, 30) # 12:30
|
||||
datetime_3 = datetime.datetime(2024, 11, 20, 13, 0) # 13:00
|
||||
|
||||
period_1 = vPeriod((datetime_1,datetime_2))
|
||||
period_2 = vPeriod((datetime_1,datetime_3))
|
||||
period_3 = vPeriod((datetime_2,datetime_3))
|
||||
|
||||
assert period_1.overlaps(period_2)
|
||||
assert period_3.overlaps(period_2)
|
||||
assert not period_1.overlaps(period_3)
|
||||
|
|
Ładowanie…
Reference in New Issue