Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions news/876.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed :attr:`vSkip.ical_value <icalendar.prop.recur.skip.vSkip.ical_value>` returning ``vSkip.OMIT`` instead of the :rfc:`7529` value ``OMIT``. I used Claude Opus 5.5 to help locate the bug. @jakkoyang
13 changes: 13 additions & 0 deletions src/icalendar/prop/recur/skip.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,19 @@ class vSkip(vText, Enum):
def __repr__(self):
return f"{self.__class__.__name__}({self._name_!r})"

@property
def ical_value(self) -> str:
"""The :rfc:`7529` SKIP value, for example ``OMIT``.

Example:
.. code-block:: pycon

>>> from icalendar import vSkip
>>> vSkip.FORWARD.ical_value
'FORWARD'
"""
return self.name

@classmethod
def parse_jcal_value(cls, value: Any) -> Self:
"""Parse a jCal value for vSkip.
Expand Down
24 changes: 24 additions & 0 deletions src/icalendar/tests/prop/test_vSkip.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
"""Tests for vSkip.ical_value (issue #876)."""

import pytest

from icalendar.prop import vSkip


@pytest.mark.parametrize(
("skip", "expected"),
[
(vSkip.OMIT, "OMIT"),
(vSkip.FORWARD, "FORWARD"),
(vSkip.BACKWARD, "BACKWARD"),
],
)
def test_ical_value_is_the_rfc_7529_token(skip, expected):
"""ical_value returns the RFC 7529 SKIP token, not the enum name."""
assert skip.ical_value == expected


@pytest.mark.parametrize("skip", list(vSkip))
def test_ical_value_is_a_plain_str(skip):
"""ical_value is a plain str, not a vText (isinstance would accept both)."""
assert type(skip.ical_value) is str
Loading