o
    `^h                     @   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   )tmpdircachedirasizeof_itarget_sizenoutput r   S/home/air/shanriGPT/back/venv/lib/python3.10/site-packages/joblib/test/test_disk.pytest_disk_used   s   
r    z
text,value)80Gl       P z1.4Mgffffff6A)120Mi  )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,regex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_exception-   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 )Nhamspam )r   r   r   r   r   r   OSError)r   r   r   r   test_mkdirp6   s   

"r2   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 )Namstramgram)r   r   r   r   r   r   exists)r   sub_path	full_pathr   r   r   test_rm_subdirs@   s   r9   )__doc__
__future__r   r   r   joblib.diskr   r   r   r   joblib.testingr   r   r    r   r'   
ValueErrorr-   r2   r9   r   r   r   r   <module>   s.    	



