| 1 | """The atlassian confluence calendar sets the count value to -1 when future events are deleted. |
| 2 | |
| 3 | See https://github.com/niccokunzmann/python-recurring-ical-events/issues/128 |
| 4 | """ |
| 5 | |
| 6 | import pytest |
| 7 | |
| 8 | import recurring_ical_events.constants |
| 9 | |
| 10 | |
| 11 | def test_all_events_are_present(calendars): |
| 12 | """All events are shown and not just the first one.""" |
| 13 | assert len(list(calendars.issue_128_only_first_event.all())) == 7 |
| 14 | |
| 15 | |
| 16 | @pytest.mark.parametrize( |
| 17 | ("string", "matches"), |
| 18 | [ |
| 19 | ("COUNT=1", False), |
| 20 | ("COUNT=1;", False), |
| 21 | ("COUNT=-1", True), |
| 22 | ("COUNT=-1;", True), |
| 23 | ("COUNT=-100", True), |
| 24 | ("COUNT=-100;", True), |
| 25 | ], |
| 26 | ) |
| 27 | def test_matching_negative_count(string, matches): |
| 28 | """Make sure the general replacement pattern works.""" |
| 29 | actually_matches = ( |
| 30 | recurring_ical_events.constants.NEGATIVE_RRULE_COUNT_REGEX.match(string) |
| 31 | is not None |
| 32 | ) |
| 33 | assert actually_matches == matches |