From f56217b3e4dba69bc8bde4bb38221145bacd94da Mon Sep 17 00:00:00 2001 From: Jakko Yang Date: Thu, 12 Nov 2026 22:11:34 -0500 Subject: [PATCH] Fix vSkip.ical_value returning the enum name Part of #876. AI: Claude Opus 5.5 Prompt (summary): help find why vSkip.ical_value returns 'vSkip.OMIT' and plan a fix and tests. Output: Guidance only. I wrote the fix, tests, and news entry myself and ran the full test suite locally. --- news/876.bugfix | 1 + src/icalendar/prop/recur/skip.py | 13 +++++++++++++ src/icalendar/tests/prop/test_vSkip.py | 24 ++++++++++++++++++++++++ 3 files changed, 38 insertions(+) create mode 100644 news/876.bugfix create mode 100644 src/icalendar/tests/prop/test_vSkip.py diff --git a/news/876.bugfix b/news/876.bugfix new file mode 100644 index 000000000..17fb780fb --- /dev/null +++ b/news/876.bugfix @@ -0,0 +1 @@ +Fixed :attr:`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 diff --git a/src/icalendar/prop/recur/skip.py b/src/icalendar/prop/recur/skip.py index 157cafdc9..805d121d8 100644 --- a/src/icalendar/prop/recur/skip.py +++ b/src/icalendar/prop/recur/skip.py @@ -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. diff --git a/src/icalendar/tests/prop/test_vSkip.py b/src/icalendar/tests/prop/test_vSkip.py new file mode 100644 index 000000000..a2b8ea8ed --- /dev/null +++ b/src/icalendar/tests/prop/test_vSkip.py @@ -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