Skip to content

Commit

Permalink
Merge pull request #670 from rahul50502a/Issue-610
Browse files Browse the repository at this point in the history
Solve issue #610
  • Loading branch information
niccokunzmann committed Jul 4, 2024
2 parents 9cac950 + 4dc2ea2 commit 7fb1567
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/icalendar/prop.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,9 @@ def __init__(self, c_list):
self.cats = [vText(c) for c in c_list]
self.params = Parameters()

def __iter__(self):
return iter(vCategory.from_ical(self.to_ical()))

def to_ical(self):
return b",".join([c.to_ical() for c in self.cats])

Expand Down
4 changes: 4 additions & 0 deletions src/icalendar/tests/prop/test_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,9 @@ def test_prop_vCategory(self):

self.assertEqual(v_cat.to_ical(), b'cat 1,cat 2,cat 3')
self.assertEqual(vCategory.from_ical(v_cat.to_ical()), catz)
c = vCategory(vCategory.from_ical("APPOINTMENT,EDUCATION"))
cats = list(c)
assert cats == ["APPOINTMENT", "EDUCATION"]

def test_prop_TypesFactory(self):
from icalendar.prop import TypesFactory
Expand Down Expand Up @@ -365,3 +368,4 @@ def test_prop_TypesFactory(self):
factory.from_ical('cn', b'Rasmussen\\, Max M\xc3\xb8ller'),
'Rasmussen, Max M\xf8ller'
)

0 comments on commit 7fb1567

Please sign in to comment.