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 )KzThis 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   






	