+
    ¾¾j•)  ã                   óŽ   € R t ^ RIHtHtHt ^ RIHt  ! R R4      t ! R R4      t ! R R4      t	 ! R	 R
4      t
 ! R R4      tR# )aÉ  Tests for custom component parsing and handling.

Custom components include:
- X-Components (vendor-specific, starting with X-)
- IANA-Components (registered but not in RFC 5545)
- Any unrecognized component names

According to RFC 5545:
- Applications MUST ignore custom components they don't recognize
- Applications SHOULD NOT silently drop components (data loss prevention)

icalendar preserves all custom components through dynamic component creation.
)ÚCalendarÚ	ComponentÚEvent)ÚComponentFactoryc                   ó<   a € ] tR t^t o RtR tR tR tR tRt	V t
R# )ÚTestComponentFactoryz3Test ComponentFactory's dynamic component creation.c                óˆ   € \        4       pVP                  R4      pVP                  R8X  g   Q hVP                  R8X  g   Q hR# )z4Factory creates component classes for unknown names.zMy-ComponentzMY-COMPONENTÚMyComponentN)r   Úget_component_classÚnameÚ__name__)ÚselfÚfactoryÚmy_component_classs   &  Úe/home/ralf/ical-fahrzeuge/venv/lib/python3.14/site-packages/icalendar/tests/test_custom_components.pyÚ"test_create_custom_component_classÚ7TestComponentFactory.test_create_custom_component_class   sC   € ä"Ó$ˆØ$×8Ñ8¸ÓHÐØ!×&Ñ&¨.Ô8Ð8Ð8Ø!×*Ñ*¨mÔ;Ð;Ò;ó    c                ól   € \        4       pVP                  R4      p\        V\        4      '       g   Q hR# )z6Dynamically created components inherit from Component.úX-CUSTOMN)r   r
   Ú
issubclassr   )r   r   Úcustom_classs   &  r   Ú-test_custom_component_inherits_from_componentÚBTestComponentFactory.test_custom_component_inherits_from_component   s-   € ä"Ó$ˆØ×2Ñ2°:Ó>ˆÜ˜,¬	×2Ò2Ð2Ò2r   c                ól   € \        4       pVP                  R4      pVP                  R4      pW#J g   Q hR# )z1Factory returns same class for repeated requests.úX-VENDORN)r   r
   )r   r   Úclass1Úclass2s   &   r   Ú%test_factory_caches_component_classesÚ:TestComponentFactory.test_factory_caches_component_classes#   s6   € ä"Ó$ˆØ×,Ñ,¨ZÓ8ˆØ×,Ñ,¨ZÓ8ˆØÓÐÒr   c                óˆ   € \        4       pVP                  R4      pVP                  R8X  g   Q hVP                  R8X  g   Q hR# )z7Factory sanitizes non-alphanumeric characters in names.zX-MY-COMPONENTÚXMYCOMPONENTN)r   r
   r   r   )r   r   Úcomponent_classs   &  r   Útest_sanitizes_component_namesÚ3TestComponentFactory.test_sanitizes_component_names*   sD   € ä"Ó$ˆØ!×5Ñ5Ð6FÓGˆà×'Ñ'¨>Ô9Ð9Ð9Ø×#Ñ#Ð'7Ô7Ð7Ò7r   © N)r   Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   r   r   r#   Ú__static_attributes__Ú__classdictcell__©Ú__classdict__s   @r   r   r      s!   ø‡ € Ù=ò<ò3ò ÷8ð 8r   r   c                   óH   a € ] tR t^3t o RtR tR tR tR tR t	R t
RtV tR	# )
Ú(TestCustomComponentWithComponentFromIcalz;Test parsing custom components using Component.from_ical().c                ó`   € VP                   pVP                  4       VP                  8X  g   Q hR# )z1Parse a standalone custom component (issue #178).N)Ú1issue_178_component_with_invalid_name_representedÚto_icalÚraw_ics©r   Ú	calendarsÚcalendars   && r   Ú&test_parse_standalone_custom_componentÚOTestCustomComponentWithComponentFromIcal.test_parse_standalone_custom_component6   s,   € ð ×NÑNˆà×ÑÓ! X×%5Ñ%5Ô5Ð5Ò5r   c                ó\   € Rp\         P                  ! V4      pVP                  R8X  g   Q hR# )z#Custom component name is preserved.s(   BEGIN:X-MYCOMPONENT
END:X-MYCOMPONENT
zX-MYCOMPONENTN©r   Ú	from_icalr   ©r   Úics_dataÚcomps   &  r   Ú$test_custom_component_preserves_nameÚMTestCustomComponentWithComponentFromIcal.test_custom_component_preserves_name=   s)   € àBˆÜ×"Ò" 8Ó,ˆØ�y‰y˜OÔ+Ð+Ò+r   c                ó¼   € Rp\         P                  ! V4      pVP                  R8X  g   Q hVR,          R8X  g   Q hVR,          R8X  g   Q hVR,          R8X  g   Q hR	# )
z&Custom components can have properties.sd   BEGIN:X-VENDOR
SUMMARY:Vendor Component
X-VENDOR-PROP:proprietary value
UID:vendor-123
END:X-VENDOR
r   ÚSUMMARYzVendor ComponentzX-VENDOR-PROPzproprietary valueÚUIDz
vendor-123Nr:   r<   s   &  r   Ú%test_custom_component_with_propertiesÚNTestCustomComponentWithComponentFromIcal.test_custom_component_with_propertiesC   sf   € ðˆô ×"Ò" 8Ó,ˆØ�y‰y˜JÔ&Ð&Ð&Ø�I�Ð"4Ô4Ð4Ð4Ø�OÕ$Ð(;Ô;Ð;Ð;Ø�E�{˜lÔ*Ð*Ò*r   c                óŒ   € Rp\         P                  ! V4      pVP                  4       pRV9   g   Q hRV9   g   Q hRV9   g   Q hR# )z-Custom components survive round-trip parsing.s(   BEGIN:X-TEST
SUMMARY:Test
END:X-TEST
s   BEGIN:X-TESTs   SUMMARY:Tests
   END:X-TESTN)r   r;   r2   )r   Úoriginalr>   Úregenerateds   &   r   Ú test_custom_component_round_tripÚITestCustomComponentWithComponentFromIcal.test_custom_component_round_tripQ   sL   € àDˆÜ×"Ò" 8Ó,ˆØ—l‘l“nˆØ +Ô-Ð-Ð-Ø +Ô-Ð-Ð-Ø Ô+Ð+Ò+r   c                ó`   € VP                   pVP                  4       VP                  8X  g   Q hR# )z>Custom component can contain standard components (issue #178).N)Ú)issue_178_custom_component_contains_otherr2   r3   r4   s   && r   Ú5test_custom_component_can_contain_standard_componentsÚ^TestCustomComponentWithComponentFromIcal.test_custom_component_can_contain_standard_componentsZ   s,   € ð ×FÑFˆØ×ÑÓ! X×%5Ñ%5Ô5Ð5Ò5r   c                ó   € Rp\         P                  ! V4      pVP                  R8X  g   Q h\        VP                  4      ^8X  g   Q hVP                  ^ ,          pVP                  R8X  g   Q hVR,          R8X  g   Q hVR,          R8X  g   Q hR# )	z)Parse custom component containing VEVENT.s�   BEGIN:X-CONTAINER
SUMMARY:Container
BEGIN:VEVENT
UID:event-1
DTSTART:20240101T120000Z
SUMMARY:Event inside custom
END:VEVENT
END:X-CONTAINER
úX-CONTAINERÚVEVENTrC   zevent-1rB   zEvent inside customN)r   r;   r   ÚlenÚsubcomponents)r   r=   Ú	containerÚevents   &   r   Ú,test_parse_custom_component_containing_eventÚUTestCustomComponentWithComponentFromIcal.test_parse_custom_component_containing_event`   sŽ   € ðˆô ×'Ò'¨Ó1ˆ	Ø�~‰~ Ô.Ð.Ð.Ü�9×*Ñ*Ó+¨qÔ0Ð0Ð0Ø×'Ñ'¨Õ*ˆØ�z‰z˜XÔ%Ð%Ð%Ø�U�|˜yÔ(Ð(Ð(Ø�YÕÐ#8Ô8Ð8Ò8r   r%   N)r   r&   r'   r(   r)   r7   r?   rD   rI   rM   rV   r*   r+   r,   s   @r   r/   r/   3   s+   ø‡ € ÙEò6ò,ò+ò,ò6÷9ð 9r   r/   c                   ó<   a € ] tR t^tt o RtR tR tR tR tRt	V t
R# )Ú'TestCustomComponentWithCalendarFromIcalz:Test parsing custom components using Calendar.from_ical().c                ó`   € VP                   pVP                  4       VP                  8X  g   Q hR# )z4Calendar can contain custom components (issue #178).N)Ú'issue_178_custom_component_inside_otherr2   r3   r4   s   && r   Ú#test_calendar_with_custom_componentÚKTestCustomComponentWithCalendarFromIcal.test_calendar_with_custom_componentw   s,   € ð ×DÑDˆØ×ÑÓ! X×%5Ñ%5Ô5Ð5Ò5r   c                óÚ   € Rp\         P                  ! V4      p\        VP                  4      ^8X  g   Q hVP                  ^ ,          pVP                  R8X  g   Q hVR,          R8X  g   Q hR# )z,Parse VCALENDAR containing custom component.s‹   BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//Test//EN
BEGIN:X-CUSTOM
UID:custom-1
SUMMARY:Custom component in calendar
END:X-CUSTOM
END:VCALENDAR
r   rC   zcustom-1N©r   r;   rR   rS   r   )r   r=   ÚcalÚcustoms   &   r   Ú/test_parse_calendar_containing_custom_componentÚWTestCustomComponentWithCalendarFromIcal.test_parse_calendar_containing_custom_component}   sh   € ðˆô × Ò  Ó*ˆÜ�3×$Ñ$Ó%¨Ô*Ð*Ð*Ø×"Ñ" 1Õ%ˆØ�{‰{˜jÔ(Ð(Ð(Ø�e�} 
Ô*Ð*Ò*r   c                óö   € Rp\         P                  ! V4      p\        VP                  4      ^8X  g   Q hVP                   Uu. uF  q3P                  NK  	  ppRV9   g   Q hRV9   g   Q hRV9   g   Q hR# u upi )z0Calendar can mix standard and custom components.sþ   BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//Test//EN
BEGIN:VEVENT
UID:event-1
DTSTART:20240101T120000Z
SUMMARY:Standard event
END:VEVENT
BEGIN:X-VENDOR
UID:vendor-1
X-PROP:value
END:X-VENDOR
BEGIN:VTODO
UID:todo-1
SUMMARY:Standard todo
END:VTODO
END:VCALENDAR
rQ   r   ÚVTODONr_   )r   r=   r`   r>   Únamess   &    r   Ú7test_calendar_with_mixed_standard_and_custom_componentsÚ_TestCustomComponentWithCalendarFromIcal.test_calendar_with_mixed_standard_and_custom_componentsŽ   sƒ   € ðˆô$ × Ò  Ó*ˆÜ�3×$Ñ$Ó%¨Ô*Ð*Ð*ð (+×'8Ò'8Ó9Ñ'8˜t—”Ñ'8ˆÐ9Ø˜5Ô Ð Ð Ø˜UÔ"Ð"Ð"Ø˜%ÔÐÒùò :s   ÁA6c                óz   € Rp\         P                  ! V4      pVP                  4       pRV9   g   Q hRV9   g   Q hR# )z1Custom components in calendar survive round-trip.sg   BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//Test//EN
BEGIN:X-MYAPP
X-SETTING:value
END:X-MYAPP
END:VCALENDAR
s   BEGIN:X-MYAPPs   X-SETTING:valueN©r   r;   r2   )r   rG   r`   rH   s   &   r   Ú,test_custom_component_round_trip_in_calendarÚTTestCustomComponentWithCalendarFromIcal.test_custom_component_round_trip_in_calendar«   sB   € ðˆô × Ò  Ó*ˆØ—k‘k“mˆØ ;Ô.Ð.Ð.Ø! [Ô0Ð0Ò0r   r%   N)r   r&   r'   r(   r)   r\   rb   rg   rk   r*   r+   r,   s   @r   rY   rY   t   s!   ø‡ € ÙDò6ò+ò" ÷:1ð 1r   rY   c                   ó<   a € ] tR t^»t o RtR tR tR tR tRt	V t
R# )ÚTestCustomComponentAPIz=Test that custom components work with standard Component API.c                ó¦   € \        RR7      pVP                  RR4       VP                  RR4       VR,          R8X  g   Q hVR,          R8X  g   Q hR	# )
z'Can add properties to custom component.úX-TEST©r   ÚsummaryzTest Summaryzx-customzCustom ValuerB   r   N)r   Úadd©r   r>   s   & r   Ú%test_add_property_to_custom_componentÚ<TestCustomComponentAPI.test_add_property_to_custom_component¾   sM   € ä˜hÔ'ˆØ�‰�˜NÔ+Ø�‰�˜^Ô,Ø�I� .Ô0Ð0Ð0Ø�JÕ >Ô1Ð1Ò1r   c                ó  € \        RR7      p\        4       pVP                  RR4       VP                  RR4       VP                  V4       \	        VP
                  4      ^8X  g   Q hVP
                  ^ ,          P                  R8X  g   Q hR# )	z*Can add subcomponents to custom component.rP   rq   ÚuidÚ123rr   z
Test EventrQ   N)r   r   rs   Úadd_componentrR   rS   r   )r   rT   rU   s   &  r   Ú)test_add_subcomponent_to_custom_componentÚ@TestCustomComponentAPI.test_add_subcomponent_to_custom_componentÆ   su   € ä =Ô1ˆ	Ü“ˆØ�	‰	�%˜ÔØ�	‰	�)˜\Ô*à×Ñ Ô&Ü�9×*Ñ*Ó+¨qÔ0Ð0Ð0Ø×&Ñ& qÕ)×.Ñ.°(Ô:Ð:Ò:r   c                ó  € \        RR7      pVP                  RR4       VP                  RR4       \        VP                  4       4      pV UUu. uF  w  r4VNK	  	  pppRV9   g   Q hRV9   g   Q hR	V9   g   Q hR
V9   g   Q hR# u uppi )z0Can iterate over properties in custom component.rp   rq   Úprop1Úvalue1Úprop2Úvalue2ÚPROP1ÚPROP2ÚBEGINÚENDN)r   rs   ÚlistÚproperty_items)r   r>   Úpropsr   ÚvalueÚ
prop_namess   &     r   Útest_custom_component_iterationÚ6TestCustomComponentAPI.test_custom_component_iterationÑ   s�   € ä˜hÔ'ˆØ�‰�˜(Ô#Ø�‰�˜(Ô#ô �T×(Ñ(Ó*Ó+ˆÙ.3Ô4©e™{˜t“d©eˆ
Ñ4Ø˜*Ô$Ð$Ð$Ø˜*Ô$Ð$Ð$Ø˜*Ô$Ð$Ð$Ø˜
Ô"Ð"Ò"ùó	 5s   ÁBc                óÎ   € \        RR7      pVP                  RR4       VP                  R4      R8X  g   Q hVP                  R4      e   Q hVP                  RR4      R8X  g   Q hR# )	z)Can use get() method on custom component.rp   rq   Úexistingr‰   ÚEXISTINGÚNONEXISTENTNÚdefault)r   rs   Úgetrt   s   & r   Ú test_custom_component_get_methodÚ7TestCustomComponentAPI.test_custom_component_get_methodß   s_   € ä˜hÔ'ˆØ�‰�˜WÔ%à�x‰x˜
Ó# wÔ.Ð.Ð.Ø�x‰x˜Ó&Ò.Ð.Ð.Ø�x‰x˜ yÓ1°YÔ>Ð>Ò>r   r%   N)r   r&   r'   r(   r)   ru   r{   r‹   r“   r*   r+   r,   s   @r   rn   rn   »   s!   ø‡ € ÙGò2ò	;ò#÷?ð ?r   rn   c                   ó<   a € ] tR t^ét o RtR tR tR tR tRt	V t
R# )ÚTestRFC5545Compliancez/Test RFC 5545 compliance for custom components.c                óz   € Rp\         P                  ! V4      pVP                  4       pRV9   g   Q hRV9   g   Q hR# )z-X-components (vendor-specific) are preserved.sj   BEGIN:VCALENDAR
VERSION:2.0
BEGIN:X-VENDOR-COMP
X-VENDOR-PROP:proprietary
END:X-VENDOR-COMP
END:VCALENDAR
s   X-VENDOR-COMPs   X-VENDOR-PROPNrj   ©r   r=   r`   rH   s   &   r   Útest_preserves_x_componentsÚ1TestRFC5545Compliance.test_preserves_x_componentsì   sD   € ðˆô × Ò  Ó*ˆØ—k‘k“mˆð   ;Ô.Ð.Ð.Ø ;Ô.Ð.Ò.r   c                óz   € Rp\         P                  ! V4      pVP                  4       pRV9   g   Q hRV9   g   Q hR# )z)IANA-registered components are preserved.so   BEGIN:VCALENDAR
VERSION:2.0
BEGIN:VFUTURE
UID:future-1
SUMMARY:Future IANA component
END:VFUTURE
END:VCALENDAR
s   VFUTUREs   Future IANA componentNrj   r˜   s   &   r   Útest_preserves_iana_componentsÚ4TestRFC5545Compliance.test_preserves_iana_componentsü   sD   € ðˆô × Ò  Ó*ˆØ—k‘k“mˆð ˜[Ô(Ð(Ð(Ø'¨;Ô6Ð6Ò6r   c                óÖ   € Rp\         P                  ! V4      p\        VP                  4      ^8X  g   Q hVP                   Uu0 uF  q3P                  kK  	  ppV0 Rm8X  g   Q hR# u upi )z8Custom components are never silently dropped (RFC 5545).s˜   BEGIN:VCALENDAR
VERSION:2.0
BEGIN:X-UNKNOWN1
UID:1
END:X-UNKNOWN1
BEGIN:X-UNKNOWN2
UID:2
END:X-UNKNOWN2
BEGIN:UNKNOWN3
UID:3
END:UNKNOWN3
END:VCALENDAR
N>   ÚUNKNOWN3ú
X-UNKNOWN1ú
X-UNKNOWN2r_   )r   r=   r`   r>   Úcomponent_namess   &    r   Ú-test_does_not_silently_drop_custom_componentsÚCTestRFC5545Compliance.test_does_not_silently_drop_custom_components  si   € ðˆô × Ò  Ó*ˆô �3×$Ñ$Ó%¨Ô*Ð*Ð*Ø14×1BÒ1BÓCÑ1B¨Ÿ9œ9Ñ1BˆÐCØÒ"JÔJÐJÒJùò Ds   ÁA&c                óÌ  € Rp\         P                  ! V4      pVP                  R8X  g   Q h\        VP                  4      ^8X  g   Q hVP                  ^ ,          pVP                  R8X  g   Q hVR,          R8X  g   Q hVP                  4       p\         P                  ! V4      p\        VP                  4      ^8X  g   Q hVP                  ^ ,          P                  R8X  g   Q hR# )z-Nested custom components are fully preserved.sP   BEGIN:X-OUTER
SUMMARY:Outer
BEGIN:X-INNER
SUMMARY:Inner
END:X-INNER
END:X-OUTER
zX-OUTERzX-INNERrB   ÚInnerN)r   r;   r   rR   rS   r2   )r   r=   ÚouterÚinnerrH   Úreparseds   &     r   Ú'test_nested_custom_components_preservedÚ=TestRFC5545Compliance.test_nested_custom_components_preserved$  sÐ   € ðˆô ×#Ò# HÓ-ˆØ�z‰z˜YÔ&Ð&Ð&Ü�5×&Ñ&Ó'¨1Ô,Ð,Ð,à×#Ñ# AÕ&ˆØ�z‰z˜YÔ&Ð&Ð&Ø�YÕ 7Ô*Ð*Ð*ð —m‘m“oˆÜ×&Ò& {Ó3ˆÜ�8×)Ñ)Ó*¨aÔ/Ð/Ð/Ø×%Ñ% aÕ(×-Ñ-°Ô:Ð:Ò:r   r%   N)r   r&   r'   r(   r)   r™   rœ   r£   rª   r*   r+   r,   s   @r   r–   r–   é   s"   ø‡ € Ù9ò/ò 7ò$K÷,;ð ;r   r–   N)r)   Ú	icalendarr   r   r   Úicalendar.cal.component_factoryr   r   r/   rY   rn   r–   r%   r   r   Ú<module>r®      sO   ðñ÷ 1Ñ 0Ý <÷8ñ 8÷@>9ñ >9÷BD1ñ D1÷N+?ñ +?÷\P;ó P;r   