o
    ^Zh                     @   s   d Z ddlmZ ddlZddlZddlmZmZmZm	Z	 ddl
mZmZ dd Zedd	d
edfddgdd Zeddedfdedfgdd Zdd Zdd ZdS )z$
Unit tests for the disk utilities.
    )with_statementN)	disk_usedmemstr_to_bytesmkdirp
rm_subdirs)parametrizeraisesc                 C   s   | j }td}|j}d}t|d | }td|d }ttj|dd}|| W d    n1 s7w   Y  t	||ksDJ t	||d k sNJ d S )Nii   )   testwb   )
strpatharrayitemsizeintopenospathjointofiler   )tmpdirZcachediraZsizeof_iZtarget_sizenoutput r   D/var/www/auris/lib/python3.10/site-packages/joblib/test/test_disk.pytest_disk_used   s   
r   z
text,value)Z80Gl       P z1.4Mgffffff6A)Z120Mi  )Z53Ki   c                 C   s   t | |ksJ d S N)r   )textvaluer   r   r   test_memstr_to_bytes%   s   
r!   ztext,exception,regexZfooGz Invalid literal for size.*fooG.*z1.4Nz Invalid literal for size.*1.4N.*c                 C   sB   t |}t|  W d    n1 sw   Y  ||sJ d S r   )r   r   match)r   	exceptionregexexcinfor   r   r   test_memstr_to_bytes_exception2   s   

r&   c                 C   st   t tj| jd t tj| jd t tj| jdd tt t d W d    d S 1 s3w   Y  d S )NZhamZspam )r   r   r   r   r   r   OSError)r   r   r   r   test_mkdirp?   s   

"r)   c                 C   s\   t j| jdd}t j|d}tt j| t| t j|s$J t j|r,J d S )NZ
subdir_oneZ
subdir_twoZsubdir_three)r   r   r   r   r   r   exists)r   Zsub_path	full_pathr   r   r   test_rm_subdirsI   s   r,   )__doc__
__future__r   r   r   Zjoblib.diskr   r   r   r   Zjoblib.testingr   r   r   r   r!   
ValueErrorr&   r)   r,   r   r   r   r   <module>   s2    	

	

