a
    =_                     @   s  d dl Z d dlmZ zd dlmZ W n eyB   d dlmZ Y n0 d dlmZ d dl	m
Z
 d dl	mZ d dlm  mZ d dlm  mZ d dlm  mZ G dd deZG d	d
 d
eZG dd deZdd Zedkree j e  e
jdd dS )    N)StringIO)patch)common)unittest)PyTablesTestCasec                   @   s0   e Zd ZdZeedeeddd ZdS )ptrepackTestCasezTest ptrepackZ	copy_leaf	open_filec           
      C   s   d}d}d}d}d|d | |d | g}t td| t  W d   n1 sV0    Y  |jd	 \}}	| ||d
f |jd	 \}}	| |||||f dS )3Checking handling of windows filenames: test gh-616zD:\window~1\path\000\infile/zanother\path\z/path/in/outfileptrepack:argvNr   r)r   objectsysr   maincall_args_listassertEqual)
selfmock_open_fileZmock_copy_leafsrc_fnsrc_pathZdst_fnZdst_pathr   argskwargs r   6lib/python3.9/site-packages/tables/tests/test_utils.pytest_paths_windows   s    &z#ptrepackTestCase.test_paths_windowsN)__name__
__module____qualname____doc__r   r   r   r   r   r   r   r   r      s   

r   c                   @   s0   e Zd ZdZeedededdd ZdS )ptdumpTestCaseTest ptdumpr   
sys.stdoutZnew_callablec                 C   sp   d}d}d|d | g}t td| t  W d   n1 sD0    Y  |jd \}}| ||df dS )	r	   zD:\window~1\path\000\ptdumpr
   ptdumpr   r   Nr   r   )r   r   r   r%   r   r   r   )r   _r   r   r   r   r   r   r   r   r   r   /   s    &z!ptdumpTestCase.test_paths_windowsN)	r   r   r   r    r   r   r%   r   r   r   r   r   r   r!   ,   s   

r!   c                   @   s>   e Zd ZdZeejdeedededdd Z	dS )	pttreeTestCaser"   r   Zget_tree_strr#   r$   c           	      C   sp   d}d}d|d | g}t td| t  W d   n1 sD0    Y  |jd \}}| ||df dS )	r	   zD:\window~1\path\000\pttreer
   pttreer   r   Nr   r   )r   r   r   r(   r   r   r   )	r   r&   Zmock_get_tree_strr   r   r   r   r   r   r   r   r   r   D   s    &z!pttreeTestCase.test_paths_windowsN)
r   r   r   r    r   r   r(   Ztablesr   r   r   r   r   r   r'   A   s
   

r'   c                  C   s<   t  } | t t | t t | t t | S )N)r   Z	TestSuiteZaddTestZ	makeSuiter   r!   r'   )ZtheSuiter   r   r   suiteW   s
    r)   __main__)ZdefaultTest)r   ior   Zunittest.mockr   ImportErrorZmockZtables.testsr   Ztables.tests.commonr   r   ZTestCaseZtables.scripts.ptrepackZscriptsr   Ztables.scripts.ptdumpr%   Ztables.scripts.pttreer(   r   r!   r'   r)   r   Z
parse_argvr   Zprint_versionsr   r   r   r   r   <module>   s&   	