@@ -731,6 +731,49 @@ def test_expand_rrule_notz_until_z(self):
731731END:VCALENDAR
732732"""
733733
734+ event_exdate_d = """BEGIN:VCALENDAR
735+ VERSION:2.0
736+ BEGIN:VEVENT
737+ UID:event_exdate_d123
738+ DTSTAMP:20140627T162546Z
739+ DTSTART;TZID=Europe/Berlin:20140702T190000
740+ DTEND;TZID=Europe/Berlin:20140702T193000
741+ SUMMARY:Test event
742+ RRULE:FREQ=DAILY;COUNT=10
743+ EXDATE:20140703
744+ END:VEVENT
745+ END:VCALENDAR
746+ """
747+
748+ event_exdate_ds = """BEGIN:VCALENDAR
749+ VERSION:2.0
750+ BEGIN:VEVENT
751+ UID:event_exdate_ds123
752+ DTSTAMP:20140627T162546Z
753+ DTSTART;VALUE=DATE:20140702
754+ DTEND;VALUE=Date:20140702
755+ SUMMARY:Test event
756+ RRULE:FREQ=DAILY;COUNT=10
757+ EXDATE:20140703
758+ END:VEVENT
759+ END:VCALENDAR
760+ """
761+
762+ event_exdate_d_multi = """BEGIN:VCALENDAR
763+ VERSION:2.0
764+ BEGIN:VEVENT
765+ UID:event_exdate_d_multi123
766+ DTSTAMP:20140627T162546Z
767+ DTSTART;TZID=Europe/Berlin:20140702T080000
768+ DTEND;TZID=Europe/Berlin:20140702T083000
769+ SUMMARY:Test event
770+ RRULE:FREQ=HOURLY;INTERVAL=8;COUNT=9
771+ EXDATE;VALUE=DATE:20140703
772+ EXDATE;TZID=Europe/Berlin:20140704T080000
773+ END:VEVENT
774+ END:VCALENDAR
775+ """
776+
734777latest_bug = """BEGIN:VCALENDAR
735778VERSION:2.0
736779BEGIN:VEVENT
@@ -818,6 +861,35 @@ def test_event_exdatesl_dt(self):
818861 assert dtstart [0 ][0 ] == berlin .localize (dt .datetime (2014 , 7 , 2 , 19 , 0 ))
819862 assert dtstart [- 1 ][0 ] == berlin .localize (dt .datetime (2014 , 7 , 11 , 19 , 0 ))
820863
864+ def test_event_exdate_d (self ):
865+ """recurring event, one date excluded via EXCLUDE with date"""
866+ vevent = _get_vevent (event_exdate_d )
867+ dtstart = icalendar_helpers .expand (vevent , berlin )
868+ assert len (dtstart ) == 9
869+ assert dtstart [0 ][0 ] == berlin .localize (dt .datetime (2014 , 7 , 2 , 19 , 0 ))
870+ assert dtstart [- 1 ][0 ] == berlin .localize (dt .datetime (2014 , 7 , 11 , 19 , 0 ))
871+
872+ def test_event_exdate_ds (self ):
873+ """recurring event with dates, one date excluded via EXCLUDE with date"""
874+ vevent = _get_vevent (event_exdate_ds )
875+ dtstart = icalendar_helpers .expand (vevent , berlin )
876+ assert len (dtstart ) == 9
877+ assert dtstart [0 ][0 ] == dt .date (2014 , 7 , 2 )
878+ assert dtstart [- 1 ][0 ] == dt .date (2014 , 7 , 11 )
879+
880+ def test_event_exdate_d_multiple_instances_per_day (self ):
881+ """a date EXDATE excludes all instances on that day, a datetime one
882+ only the matching instance"""
883+ vevent = _get_vevent (event_exdate_d_multi )
884+ dtstart = [start for start , _ in icalendar_helpers .expand (vevent , berlin )]
885+ assert dtstart == [
886+ berlin .localize (dt .datetime (2014 , 7 , 2 , 8 )),
887+ berlin .localize (dt .datetime (2014 , 7 , 2 , 16 )),
888+ berlin .localize (dt .datetime (2014 , 7 , 4 , 0 )),
889+ berlin .localize (dt .datetime (2014 , 7 , 4 , 16 )),
890+ berlin .localize (dt .datetime (2014 , 7 , 5 , 0 )),
891+ ]
892+
821893 def test_event_exdates_remove (self ):
822894 """check if we can remove one more instance"""
823895 vevent = _get_vevent (event_exdatesl_dt )
0 commit comments