Current File : //usr/lib64/python3.6/site-packages/borg/testsuite/__pycache__/item.cpython-36.pyc
3

y��b��@s�ddlZddlmZddlmZddlmZdd�Zdd	�Zd
d�Z	dd
�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�ZdS)�N�)�ChunkListEntry)�Item)�
StableDictc:Cs<t�}|j�ikst�d|ks"t�tjt��d|kWdQRXtjt��d|kWdQRXtjt��d|kWdQRX|jd�dks�t�|jdd�dks�t�tjt��|jd�WdQRXtjt��|jd�WdQRXtjt��|jd�WdQRXtjt��|j	WdQRXtjt��
|`	WdQRXdS)N�pathzinvalid-keyspath�*�modei�smode)
r�as_dict�AssertionError�pytest�raises�
ValueError�	TypeError�get�AttributeErrorr)�item�r�/usr/lib64/python3.6/item.py�test_item_emptys*rcCs�tddd��}|jdkst�|jdks*t�d|ks6t�tddd��}|jdksRt�|jdks`t�d|kslt�tjt��td�WdQRXtjt��tddi�WdQRXtjt��td	d
i�WdQRXdS)Nz/a/b/ci�)spathsmoder)rrrr�Zfoobar�baz)rrr
rrrrr
)rrrr�test_item_from_dict%srcCs,tddd�}|jdkst�|jdks(t�dS)Nz/a/b/ci�)rr)rrr
r)rrrr�test_item_from_kw?src	Csbt�}d|_|jdkst�|j�ddiks.t�|`|j�iksBt�tjt��d|_WdQRXdS)Ni�rZinvalid)rrr
r	rrr)rrrr�test_item_int_propertyEsrcCsht�}ddd}}||_|j|ks(t�|j�d|iks<t�||_|j|ksPt�|j�dd	iksdt�dS)
Nrr�A�atime���ss	)rrr
r	)rZsmallZbigrrr�test_item_bigint_propertyPsrcCs2t�}d|_|jdkst�d|_|jdks.t�dS)N)r�userr
�group)rrrr�test_item_user_group_none[s
r"c
Cs�t�}d|_|jdkst�|j�ddiks.t�|`|j�iksBt�tjt��d|_WdQRXtddid�}|jdkszt�|j�ddiks�t�|`d|ks�t�d|_|j�ddiks�t�dS)Nz/a/b/crs/a/b/crs/a/�/c)Z
internal_dictu/a/�/c)rrr
r	rrr)rrrr�test_item_se_str_propertycsr#cCspt�}g|_|jgkst�|jjd�|jdgks6t�|jjd�|jddgksTt�|j�dddgikslt�dS)Nr��chunks)rr%r
�appendr	)rrrr�test_item_list_propertyxsr'cCszt�}t�|_|jt�kst�d|jd<|jddks:t�d|jd<|jtddd��ks\t�|j�dddd�iksvt�dS)N�bar�foor)r)r(�xattrs)rrr*r
r	)rrrr�test_item_dict_property�s

r+c	Cs&t�}tjt��d|_WdQRXdS)N)rrrrZunknown_attribute)rrrr�test_unknown_property�sr,cCs�tdtdddd�tdddd�gd�}|j�dks4t�tjt��|jddd	�WdQRX|jdd
�dkslt�|jdd�|jdks�t�dS)
Ni��r$i�)Zcsize�size�idi�)rr%i�T)�
compressed�memorize)r/r)r0)rr�get_sizer
rrr-)rrrr�test_item_file_size�sr2cCstdd�}|j�dkst�dS)Ni��)rr)rr1r
)rrrr�test_item_file_size_no_chunks�s
r3)r�cacherrrZhelpersrrrrrrr"r#r'r+r,r2r3rrrr�<module>s