U
    ¤�©j  ã                   @  sú  d Z ddlmZ ddlmZ ddlZddlmZmZm	Z	m
Z
 ddlmZ e ¡ ddœd	d
„ƒZej dddg¡Zej dddg¡Zeedd„ ƒƒZedd„ ƒZeedd„ ƒƒZeedd„ ƒƒZdd„ Zedd„ ƒZeej dddg¡d d!„ ƒƒZed"d#„ ƒZej d$d%d&g¡Zeed'd(„ ƒƒZej d)d*d+g¡Zed,d-„ ƒZed.d/„ ƒZed0d1„ ƒZd2d3„ Z ejeee
e	gd4�d5dœd6d7„ƒZ!ejd8d9gd4�d:dœd;d<„ƒZ"d5d=œd>d?„Z#d:d5d@œdAdB„Z$d:d5d@œdCdD„Z%d5d=œdEdF„Z&d5d=œdGdH„Z'd:d5d@œdIdJ„Z(dS )KzˆThis tests additional attributes from :rfc:`7986`.

Some attributes are also available as ``X-*`` attributes.
They are also considered.
é    )Úannotations)ÚUnionN)ÚCalendarÚEventÚJournalÚTodo)ÚvTextr   )Úreturnc                   C  s   t ƒ S )zEmpty calendar)r   © r
   r
   úA/tmp/pip-unpacked-wheel-g40nyxg1/icalendar/tests/test_rfc_7986.pyÚcalendar   s    r   ÚnamezCompany Vacation DayszCalendar NameÚpropÚNAMEúX-WR-CALNAMEc                 C  s   |  | |¡ |j|kst‚dS )zGet the name of the calendar.N©ÚaddÚcalendar_nameÚAssertionError)r   r   r   r
   r
   r   Útest_get_calendar_name   s    r   c                 C  s(   | |_ |j | kst‚|d | ks$t‚dS )ú.Setting the name overrides the old attributes.r   N©r   r   )r   r   r
   r
   r   Útest_set_calendar_name"   s    r   c                 C  s    d||< | |_ |j | kst‚dS )r   z
Other NameNr   )r   r   r   r
   r
   r   Útest_replace_name*   s    r   c                 C  s"   |  || ¡ |`|jdkst‚dS )zDelete the name.Nr   )r   r   r   r
   r
   r   Útest_del_name3   s    r   c                 C  s   | j dkst‚dS )zWe have no name by default.Nr   )r   r
   r
   r   Útest_default_name<   s    r   c                 C  s*   || d< d| kst ‚d| _d| ks&t ‚dS )z2The default_attr is deleted when setting the name.r   z
other nameN)r   r   ©r   r   r
   r
   r   Ú8test_setting_the_name_deletes_the_non_standard_attributeA   s    r   Úorderé   é   c                 C  sR   |dkr|   d|¡ |   dtdddid�¡ |dkr@|   d|¡ | j|ksNt‚dS )	z;Add several names and use the one without a language param.r   r   ZKalendernameÚLANGUAGEÚde©Úparamsr    N)r   r   r   r   )r   r   r   r
   r
   r   Ú2test_multiple_names_use_the_one_without_a_languageJ   s    r%   c                 C  s*   |   d|¡ |   dd¡ | j|ks&t‚dS )z(NAME is more important that X-WR-CALNAMEr   r   ÚasdNr   r   r
   r
   r   Útest_name_is_preferredV   s    r'   ÚdescZDESCRIPTIONzX-WR-CALDESCc                 C  s   |   ||¡ | j|kst‚dS ©zGet the valueN)r   Údescriptionr   )r   r(   r   r
   r
   r   Útest_descriptiond   s    r+   Úcolor_paramÚCOLORúX-APPLE-CALENDAR-COLORc                 C  s   |   ||¡ | j|kst‚dS r)   ©r   Úcolorr   ©r   r,   r0   r
   r
   r   Útest_get_calendar_colorp   s    r2   c                 C  s.   |   ||¡ | `| jdkst‚|| ks*t‚dS )zDelete the valueÚ Nr/   r1   r
   r
   r   Útest_delete_calendar_colorv   s    r4   c                 C  s4   |   |d¡ || _| j|ks t‚| d |ks0t‚dS )z,Set the color and it replaces what is there.Úgreenr-   Nr/   r1   r
   r
   r   Útest_set_calendar_color~   s    r6   c                 C  s*   |   d|¡ |   dd¡ | j|ks&t‚dS )z+We prefer COLOR over X-APPLE-CALENDAR-COLORr-   r.   r5   Nr/   )r   r0   r
   r
   r   Útest_get_COLOR_first†   s    r7   r#   z%Union[Calendar, Event, Todo, Journal]c                 C  s   |   ¡ S )z6An empty component that should have a color attribute.©Úparam©Úrequestr
   r
   r   Úcolor_component�   s    r<   Úbluez#123456Ústrc                 C  s   | j S )zReturn a color.r8   r:   r
   r
   r   r0   ”   s    r0   ©r<   c                 C  s   | j dkst‚dS )zThere is no color by default.r3   N©r0   r   r?   r
   r
   r   Útest_default_color™   s    rA   ©r0   r<   c                 C  s(   | |_ |j | kst‚|d | ks$t‚dS )zWe set the value and get it.r-   Nr@   rB   r
   r
   r   Útest_set_the_color�   s    rC   c                 C  s.   d|_ | |_ |j | kst‚|d | ks*t‚dS )zReplace the color.r=   r-   Nr@   rB   r
   r
   r   Útest_replace_color£   s    rD   c                 C  s*   |   dd¡ |   dd¡ | jdks&t‚dS ©z)Add several colors and use the first one.r-   r=   r5   Nr/   r?   r
   r
   r   Útest_multiple_colors«   s    rF   c                 C  s(   d| _ | ` d| kst‚| j dks$t‚dS )zDelete the color.r=   r-   r3   Nr@   r?   r
   r
   r   Útest_delete_the_color²   s    rG   c                 C  s0   |  dd¡ |  dd¡ | |_|j| ks,t‚dS rE   r/   rB   r
   r
   r   Útest_set_if_multiple_colorsº   s    rH   ))Ú__doc__Ú
__future__r   Útypingr   ZpytestZ	icalendarr   r   r   r   Zicalendar.propr   Zfixturer   ÚmarkZparametrizeÚ
param_nameZ
param_propr   r   r   r   r   r   r%   r'   Zparam_colorr+   r2   r4   r6   r7   r<   r0   rA   rC   rD   rF   rG   rH   r
   r
   r
   r   Ú<module>   sd   






	