本文整理汇总了Python中ics.event.Event.join方法的典型用法代码示例。如果您正苦于以下问题:Python Event.join方法的具体用法?Python Event.join怎么用?Python Event.join使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ics.event.Event
的用法示例。
在下文中一共展示了Event.join方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_join_disjoined
# 需要导入模块: from ics.event import Event [as 别名]
# 或者: from ics.event.Event import join [as 别名]
def test_join_disjoined(self):
# disjoined events
event_a = Event(name='Test #1', begin=dt(2016, 6, 10, 20, 10), duration=td(minutes=20))
event_b = Event(name='Test #2', begin=dt(2016, 6, 10, 20, 50), duration=td(minutes=20))
with pytest.raises(ValueError):
event_a.join(event_b)
with pytest.raises(ValueError):
event_b.join(event_a)
示例2: test_join_intersected
# 需要导入模块: from ics.event import Event [as 别名]
# 或者: from ics.event.Event import join [as 别名]
def test_join_intersected(self):
# intersected events
event_a = Event(name='Test #1', begin=dt(2016, 6, 10, 20, 10), duration=td(minutes=30))
event_b = Event(name='Test #2', begin=dt(2016, 6, 10, 20, 30), duration=td(minutes=30))
assert event_a.join(event_b).time_equals(Event(name=None, begin=event_a.begin, end=event_b.end))
assert event_b.join(event_a).time_equals(Event(name=None, begin=event_a.begin, end=event_b.end))
event_a = Event(name='Test #1', begin=dt(2016, 6, 10, 20, 30), duration=td(minutes=30))
event_b = Event(name='Test #2', begin=dt(2016, 6, 10, 20, 10), duration=td(minutes=30))
assert event_a.join(event_b).time_equals(Event(name=None, begin=event_b.begin, end=event_a.end))
assert event_b.join(event_a).time_equals(Event(name=None, begin=event_b.begin, end=event_a.end))
示例3: test_join_included
# 需要导入模块: from ics.event import Event [as 别名]
# 或者: from ics.event.Event import join [as 别名]
def test_join_included(self):
# included events
event_a = Event(name='Test #1', begin=dt(2016, 6, 10, 20, 00), duration=td(minutes=60))
event_b = Event(name='Test #2', begin=dt(2016, 6, 10, 20, 10), duration=td(minutes=30))
assert event_a.join(event_b).time_equals(Event(name=None, begin=event_a.begin, end=event_a.end))
assert event_b.join(event_a).time_equals(Event(name=None, begin=event_a.begin, end=event_a.end))
event_a = Event(name='Test #1', begin=dt(2016, 6, 10, 20, 10), duration=td(minutes=30))
event_b = Event(name='Test #2', begin=dt(2016, 6, 10, 20, 00), duration=td(minutes=60))
assert event_a.join(event_b).time_equals(Event(name=None, begin=event_b.begin, end=event_b.end))
assert event_b.join(event_a).time_equals(Event(name=None, begin=event_b.begin, end=event_b.end))
event = Event(uid='0', name='Test #1', begin=dt(2016, 6, 10, 20, 10), duration=td(minutes=30))
event.join(event)
assert event == Event(uid='0', name='Test #1', begin=dt(2016, 6, 10, 20, 10), duration=td(minutes=30))
示例4: test_join
# 需要导入模块: from ics.event import Event [as 别名]
# 或者: from ics.event.Event import join [as 别名]
def test_join(self):
# disjoined events
event_a = Event(name='Test #1', begin=dt(2016, 6, 10, 20, 10), duration=td(minutes=20))
event_b = Event(name='Test #2', begin=dt(2016, 6, 10, 20, 50), duration=td(minutes=20))
with pytest.raises(ValueError):
event_a.join(event_b)
with pytest.raises(ValueError):
event_b.join(event_a)
# intersected events
event_a = Event(name='Test #1', begin=dt(2016, 6, 10, 20, 10), duration=td(minutes=30))
event_b = Event(name='Test #2', begin=dt(2016, 6, 10, 20, 30), duration=td(minutes=30))
assert event_a.join(event_b) == Event(name=None, uid=event_a.uid, begin=event_a.begin, end=event_b.end)
assert event_b.join(event_a) == Event(name=None, uid=event_b.uid, begin=event_a.begin, end=event_b.end)
event_a = Event(name='Test #1', begin=dt(2016, 6, 10, 20, 30), duration=td(minutes=30))
event_b = Event(name='Test #2', begin=dt(2016, 6, 10, 20, 10), duration=td(minutes=30))
assert event_a.join(event_b) == Event(name=None, uid=event_a.uid, begin=event_b.begin, end=event_a.end)
assert event_b.join(event_a) == Event(name=None, uid=event_b.uid, begin=event_b.begin, end=event_a.end)
# included events
event_a = Event(name='Test #1', begin=dt(2016, 6, 10, 20, 00), duration=td(minutes=60))
event_b = Event(name='Test #2', begin=dt(2016, 6, 10, 20, 10), duration=td(minutes=30))
assert event_a.join(event_b) == Event(name=None, uid=event_a.uid, begin=event_a.begin, end=event_a.end)
assert event_b.join(event_a) == Event(name=None, uid=event_b.uid, begin=event_a.begin, end=event_a.end)
event_a = Event(name='Test #1', begin=dt(2016, 6, 10, 20, 10), duration=td(minutes=30))
event_b = Event(name='Test #2', begin=dt(2016, 6, 10, 20, 00), duration=td(minutes=60))
assert event_a.join(event_b) == Event(name=None, uid=event_a.uid, begin=event_b.begin, end=event_b.end)
assert event_b.join(event_a) == Event(name=None, uid=event_b.uid, begin=event_b.begin, end=event_b.end)
event = Event(uid='0', name='Test #1', begin=dt(2016, 6, 10, 20, 10), duration=td(minutes=30))
event.join(event)
assert event == Event(uid='0', name='Test #1', begin=dt(2016, 6, 10, 20, 10), duration=td(minutes=30))