Skip to content

Commit

Permalink
SOlve issue #610
Browse files Browse the repository at this point in the history
  • Loading branch information
rahul50502a committed Jun 30, 2024
1 parent 39fef78 commit 4dc2ea2
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 @@ -233,6 +233,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 4dc2ea2

Please sign in to comment.