U
    j                     @   s   d dl Z d dlZejdddgdd Zejddd	d
ddgdd Zejdddgdd Zdd Zdd Zejdddgdd Z	dd Z
dd  ZdS )!    N)fieldexpected_value)ZPRODIDu+   -//Plönë.org//NONSGML plone.app.event//EN)zX-WR-CALDESCu!   test non ascii: äöü ÄÖÜ €c                 C   s$   |j }||   d|ks td S Nzutf-8)Zcalendar_with_unicodeto_icaldecodeAssertionError)r   r   	calendarscal r
   A/tmp/pip-unpacked-wheel-g40nyxg1/icalendar/tests/test_encoding.py(test_calendar_from_ical_respects_unicode   s    r   )
test_inputr   r   )event_with_unicode_fieldsSUMMARYu!   Non-ASCII Test: ÄÖÜ äöü €)r   ZDESCRIPTIONu>   icalendar should be able to handle non-ascii: €äüöÄÜÖ.)r   ZLOCATIONu
   Tribstrül)Z%issue_64_event_with_non_ascii_summaryr   u   åäö)Z!issue_64_event_with_ascii_summaryr   Zabcdefc                 C   s&   ||  }||   d|ks"td S r   )r   r   r   )r   r   r   eventseventr
   r
   r   %test_event_from_ical_respects_unicode   s    r   )r   expected_output)Z2issue_101_icalendar_chokes_on_umlauts_in_organizeru   acme, ädmin)Zevent_with_unicode_organizeru   Джон Доуc                 C   s   | | d j d |kstd S )NZ	ORGANIZERZCN)paramsr   )r   r   r   r
   r
   r   test_events_parameter_unicoded(   s    
r   c                 C   sJ   | j dd d}|tdddddd	}| j jr:t||ksFtd
S )wIssue #237 - Fail to parse timezone with non-ascii TZID
    see https://github.com/collective/icalendar/issues/237
    ZVEVENTr   ZDTSTARTi              zAmerica/Sao_PauloN)Z4issue_237_fail_to_parse_timezone_with_non_ascii_tzidwalkdecodeddatetimeerrorsr   )r   Zin_timezonestartexpectedr
   r
   r   /test_parses_event_with_non_ascii_tzid_issue_2375   s    r!   c                 C   s   | j d dkstdS )r   Ztzidu   (UTC-03:00) BrasíliaN)issue_237_brazilia_standardr   )	timezonesr
   r
   r   2test_parses_timezone_with_non_ascii_tzid_issue_237A   s    r$   timezone_namestandarddaylightc                 C   s&   | j |d d d| ks"tdS )r   r   ZTZNAMEu
   Brasília N)r"   r   r   )r#   r%   r
   r
   r   4test_parses_timezone_with_non_ascii_tzname_issue_273H   s    r(   c                 C   sH   | j dD ]6}t|jdks&td|jd d }|dstqdS )z6
    Test if error messages are encoded properly.
    vevent   zNot the right amount of errors.r   z+Content line could not be parsed into partsN)Zbroken_icalr   lenr   r   
startswith)r   r   errorr
   r
   r   test_broken_propertyS   s    r.   c                 C   s,   | j dD ]}t|jdkstdqdS )zL
    Test if we support base64 encoded binary data in parameter values.
    r)   r   zGot too many errorsN)Z
x_locationr   r+   r   r   )r   r   r
   r
   r   test_apple_xlocation]   s    r/   )r   ZpytestmarkZparametrizer   r   r   r!   r$   r(   r.   r/   r
   r
   r
   r   <module>   s>   

	



