o
    .j                     @   sH   d Z ddlmZ ddlmZ ddlmZ ddlmZ dd Zdd	 Z	d
S )zz
Test for GitHub issue #1238:
X-properties with VALUE=<type> should be parsed using that type,
not fall back to vUnknown.
    )datetime)Calendar)vBroken)vPeriodc                 C   sd   | j }|d }t|tsJ dt|j |jtdddddks#J |jtdddddks0J dS )zQX-properties with a VALUE parameter are parsed as the correct type (issue #1238).X-FILTER-DATE-RANGEzExpected vPeriod, got i     r      N)
issue_1238
isinstancer   type__name__startr   end)	calendarscalendarresult r   T/home/thesage/.local/lib/python3.10/site-packages/icalendar/tests/test_issue_1238.py$test_x_property_respects_value_param   s
   r   c                  C   sF   d} t | }|d }t|tsJ t|dksJ |jdks!J dS )zX-properties with VALUE=PERIOD but invalid content should yield vBroken (issue #1238).

    View the discussion:
    https://github.com/collective/icalendar/pull/1288#discussion_r2962648845
    zWBEGIN:VCALENDAR
X-FILTER-DATE-RANGE;VALUE=PERIOD:this-is-not-a-period
END:VCALENDAR
r   zthis-is-not-a-periodr   N)r   	from_icalr
   r   strexpected_type)cal_strr   r   r   r   r   test_x_property_broken_value   s   
r   N)
__doc__r   	icalendarr   icalendar.prop.brokenr   icalendar.prop.dtr   r   r   r   r   r   r   <module>   s    	