U
    -e6                     @   s   G d d dZ dS )c                   @   sd   e Zd Zdd Zdd Zdd Zdd Zd	d
 Zdd Zdd Z	dd Z
dd Zdd Zdd ZdS )AbstractCopyTestsc           	      C   s  |}|}| | |  s*|||d ||s8t||d}||d}|||d| ||slt|||dd| ||st|||g ||rt||rt|||d|d  ||st||st|||dd|d  ||std S )Ndummyfile2subfile1subdir/)	mkdirsupports_empty_directoriestouchisdirAssertionErrorcpisfilermexists)	selffsfs_joinfs_bulk_operations_scenario_0	fs_targetsourcetargetZtarget_file2Ztarget_subfile1 r   [/var/www/html/Darija-Ai-Train/env/lib/python3.8/site-packages/fsspec/tests/abstract/copy.py$test_copy_file_to_existing_directory   s(    


z6AbstractCopyTests.test_copy_file_to_existing_directoryc                 C   sh   |}|}| | |||dd||d ||s:t|||dsNt|||ddsdtd S )Nr   r   znewdir/newdirr   r   r
   r   r   r   r   r   r   r   r   r   r   r   r   test_copy_file_to_new_directory'   s    

 z1AbstractCopyTests.test_copy_file_to_new_directoryc                 C   sD   |}|}| | |||dd||d |||ds@td S )Nr   r   newfile)r   r   r   r   r   r   r   r   ,test_copy_file_to_file_in_existing_directory7   s
    
z>AbstractCopyTests.test_copy_file_to_file_in_existing_directoryc                 C   s\   |}|}| | |||dd||dd |||dsBt|||ddsXtd S )Nr   r   r   r   r   r   r   r   r   'test_copy_file_to_file_in_new_directoryC   s    

 
z9AbstractCopyTests.test_copy_file_to_file_in_new_directoryc                 C   s   |}|}| | |  s.||d}|| ||s<ttddgddgD ]\}}	||d}
|rn|
d7 }
|	rz|d n|}||
| |  r||g ksn|gst|j|
|dd |rF|||dst|||dst|||d	st|||d	d
st|	||dr,t|j
|j|dddd n|||ds\t|||ddstt|||ddst|||dd	st|||dd	d
st|j
||ddd |  r||g ksn|gst|j|
|ddd |r|||ds(t|||ds>t|	||d	rTt|	||drjt|j
|j|dddd nr|||dst|||ddst|||ddst|	||dd	rt|j
||ddd |  r||g ksNn|gsNtqNd S )Nr   FTr   r   	recursiver   subfile2	nesteddir
nestedfiledetail   r"   Zmaxdepth)r   r   r	   r
   r   zipr   lsr   r   r   )r   r   r   r   r   r   r   r   source_slashtarget_slashstr   r   r   )test_copy_directory_to_existing_directoryR   sT    



"(z;AbstractCopyTests.test_copy_directory_to_existing_directoryc                 C   s  |}|}| | tddgddgD ]\}}||d}	|rD|	d7 }	||d}
|rZ|
d7 }
||	|
 ||g ksxt|j|	|
dd |||dst|||ddst|||ddst|||dd	st|||dd	d
st|||drt|j||ddd |||dr6t|j|	|
ddd |||ds^t|||ddsvt|||ddst|||dd	rt|||drt|j||ddd |||dr$tq$d S )NFTr   r   r   r!   r   r#   r$   r%   r(   r)   )	r   r*   r   r+   r   r
   r   r   r   )r   r   r   r   r   r   r   r,   r-   r.   r/   r   r   r   $test_copy_directory_to_new_directory   s:    


z6AbstractCopyTests.test_copy_directory_to_new_directoryc           	      C   s$  |}|}| | dD ]}|r(|d n|}|||dd| |||dsTt|||dsht|||dr|t|||ddrt|||drt|j|j|d	d
dd ||g kst|j||dd|dd |||dst|||dst|||ds(t|||dds@t|||drVt|j|j|d	d
dd ||g kst|j||dd|ddd |||dst|||dst|||drt|||drt|j|j|d	d
dd ||g kstqd S )NFTr   r   *r   r#   r$   r%   Fr&   Tr!   r(   r)   )r   r   r   r   r
   r   r   r+   	r   r   r   r   r   r   r   r-   r/   r   r   r   $test_copy_glob_to_existing_directory   s8    

z6AbstractCopyTests.test_copy_glob_to_existing_directoryc           	      C   s  |}|}| | dD ]}||d}|r2|d7 }|||dd| |||dsZt|||ddspt|||ddst|||ddrt|||ddd	rt|||drt|||ddrt|j||dd
d |||drt|j||dd|d
d |||ds6t|||ddsNt|||ddsft|||dds~t|||ddd	st|||drt|||ddrt|j||dd
d |||drt|j||dd|d
dd |||ds t|||dds8t|||ddsPt|||ddrht|||dr~t|||ddrt|j|j|ddd
d |||drtqd S )Nr2   r   r   r   r3   r   r#   r$   r%   Tr!   r(   r)   Fr&   )r   r   r
   r   r   r   r   r+   r4   r   r   r   test_copy_glob_to_new_directory   sH    


z1AbstractCopyTests.test_copy_glob_to_new_directoryc                 C   s   |}|}| | |  s.||d}|| ||s<t||d||d||ddg}dD ]}	|	rn|d n|}
|||
 |||dst|||dst|||dst||| |  r|	|g ks^n|gs^tq^d S )Nr   file1r   r   r   r2   r   )
r   r   r	   r
   r   r   r   r   findr+   )r   r   r   r   r   r   r   r   source_filesr-   r/   r   r   r   -test_copy_list_of_files_to_existing_directory  s&    



z?AbstractCopyTests.test_copy_list_of_files_to_existing_directoryc                 C   s   |}|}| | ||d||d||ddg}||||dd  |||dsZt|||ddspt|||ddst|||ddstd S )Nr7   r   r   r   r   r   r   )r   r   r   r   r   r   r   r9   r   r   r   (test_copy_list_of_files_to_new_directory;  s    

z:AbstractCopyTests.test_copy_list_of_files_to_new_directoryc                 C   sl   |}|}| |rt|||d||dg| ||s@t|||dsTt|||dshtd S )Nr7   r   )r   r   r   r
   r   r   r   r   r   !test_copy_two_files_new_directoryP  s    z3AbstractCopyTests.test_copy_two_files_new_directoryN)__name__
__module____qualname__r   r   r   r    r0   r1   r5   r6   r:   r;   r<   r   r   r   r   r      s   %>,,4r   N)r   r   r   r   r   <module>       