From fdd275a30d21ab1735547d3a2dee5df6532c5c9b Mon Sep 17 00:00:00 2001 From: jaca Date: Fri, 9 Sep 2022 16:14:25 +0200 Subject: [PATCH] restructure test_issue_70 --- .../issue_70_rrule_causes_attribute_error.ics | 12 +++++++++ src/icalendar/tests/test_fixed_issues.py | 26 ------------------- src/icalendar/tests/test_parsing.py | 10 +++++++ 3 files changed, 22 insertions(+), 26 deletions(-) create mode 100644 src/icalendar/tests/events/issue_70_rrule_causes_attribute_error.ics create mode 100644 src/icalendar/tests/test_parsing.py diff --git a/src/icalendar/tests/events/issue_70_rrule_causes_attribute_error.ics b/src/icalendar/tests/events/issue_70_rrule_causes_attribute_error.ics new file mode 100644 index 00000000..1e062e41 --- /dev/null +++ b/src/icalendar/tests/events/issue_70_rrule_causes_attribute_error.ics @@ -0,0 +1,12 @@ +BEGIN:VEVENT +CREATED:20081114T072804Z +UID:D449CA84-00A3-4E55-83E1-34B58268853B +DTEND:20070220T180000 +RRULE:FREQ=WEEKLY;INTERVAL=1;UNTIL=20070619T225959 +TRANSP:OPAQUE +SUMMARY:Esb mellon phone conf +DTSTART:20070220T170000 +DTSTAMP:20070221T095412Z +SEQUENCE:0 +END:VEVENT + diff --git a/src/icalendar/tests/test_fixed_issues.py b/src/icalendar/tests/test_fixed_issues.py index 15bc377c..740002c9 100644 --- a/src/icalendar/tests/test_fixed_issues.py +++ b/src/icalendar/tests/test_fixed_issues.py @@ -14,7 +14,6 @@ from backports import zoneinfo class TestIssues(unittest.TestCase): - def test_issue_53(self): """Issue #53 - Parsing failure on some descriptions? https://github.com/collective/icalendar/issues/53 @@ -104,31 +103,6 @@ def test_issue_64(self): b"DTSTART;VALUE=DATE-TIME:20120903T000000\r\nEND:VEVENT\r\n" ) - def test_issue_70(self): - """Issue #70 - e.decode("RRULE") causes Attribute Error - https://github.com/collective/icalendar/issues/70 - """ - - ical_str = """BEGIN:VEVENT -CREATED:20081114T072804Z -UID:D449CA84-00A3-4E55-83E1-34B58268853B -DTEND:20070220T180000 -RRULE:FREQ=WEEKLY;INTERVAL=1;UNTIL=20070619T225959 -TRANSP:OPAQUE -SUMMARY:Esb mellon phone conf -DTSTART:20070220T170000 -DTSTAMP:20070221T095412Z -SEQUENCE:0 -END:VEVENT""" - - cal = icalendar.Calendar.from_ical(ical_str) - recur = cal.decoded("RRULE") - self.assertIsInstance(recur, icalendar.vRecur) - self.assertEqual( - recur.to_ical(), - b'FREQ=WEEKLY;UNTIL=20070619T225959;INTERVAL=1' - ) - def test_issue_82(self): """Issue #82 - vBinary __repr__ called rather than to_ical from container types diff --git a/src/icalendar/tests/test_parsing.py b/src/icalendar/tests/test_parsing.py new file mode 100644 index 00000000..782442e5 --- /dev/null +++ b/src/icalendar/tests/test_parsing.py @@ -0,0 +1,10 @@ +'''Tests checking that parsing works''' +from icalendar import vRecur + +def test_decode_rrule_attribute_error_issue_70(events): + # Issue #70 - e.decode("RRULE") causes Attribute Error + # see https://github.com/collective/icalendar/issues/70 + recur = events.issue_70_rrule_causes_attribute_error.decoded('RRULE') + assert isinstance(recur, vRecur) + assert recur.to_ical() == b'FREQ=WEEKLY;UNTIL=20070619T225959;INTERVAL=1' +