a
    =_+                    @   s  d dl Z d dlZd dlmZmZmZmZmZ d dlmZ d dl	m
Z
 d dlmZ d dlmZ d dlmZ G dd	 d	ejeZG d
d deZG dd dejeZG dd dejeZdZdd ZG dd dejeZG dd dejeZG dd dejeZG dd dejeZG dd dejeZG dd dejeZG dd  d ejeZG d!d" d"ejeZd#d$ Z e!d%krd dl"Z"e#e"j$ e%  ej&d$d& dS )'    N)IsDescription	StringColBoolColIntColFloatCol)NotLoggedMixin)	join_path)common)unittest)PyTablesTestCasec                       s   e Zd ZdZdZdd Z f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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/d0 Z  ZS )1BasicTestCasez$Test for basic Undo/Redo operations.Fc                 C   s   | j r| d d S )Nzr+)_reopen_flag_reopenself r   8lib/python3.9/site-packages/tables/tests/test_do_undo.py
_do_reopen   s    zBasicTestCase._do_reopenc                    s   t t|   | j}|j}|j|dddgdd ||ddgd ||dd	}||d
dgd ||ddgd ||dd ||dd d S Narray      Title exampletitleanarrayArray titleagroupGroup titleanarray1Array title 1anarray2Array title 2agroup2Group title 2agroup3Group title 3)superr   setUph5filerootcreate_arraycreate_groupr   r)   r*   group	__class__r   r   r(      s    zBasicTestCase.setUpc                 C   s   t jr tdd td| jj  | j  | jddddgd | j  | 	d	| j | 
| jjd
 | 
| jjd
 |   | j  t jrtd| j | d	| j | 
| jjj ddg | 
| jjjjd | 
| jjd | 
| jjd
 dS )zChecking simple do/undo.
<-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=zRunning %s.test00_simple.../
otherarray      Another array/otherarrayr   zObject tree after redo:r   N)r	   verboseprintr0   __name__r)   enable_undor+   undoassertNotInassertEqual
_curaction_curmarkr   redoassertInr*   r4   readr   r   r   r   r   test00_simple2   s$    



zBasicTestCase.test00_simplec                 C   sJ  t jr tdd td| jj  | j  | jddddgd | jdd	dd
gd |   | j	  | 
d| j | 
d| j | | jjd | | jjd | j  | d| j | d| j | | jjj ddg | | jjj dd
g | | jjjjd | | jjjjd | | jjd | | jjd dS )z/Checking do/undo (twice operations intertwined)r1   r2   zRunning %s.test01_twice...r3   r4   r5   r6   r7   otherarray2   Another array 2r8   /otherarray2r   r   N)r	   r9   r:   r0   r;   r)   r<   r+   r   r=   r>   r?   r@   rA   rB   rC   r*   r4   rD   rF   r   r   r   r   r   test01_twiceT   s*    



zBasicTestCase.test01_twicec                 C   s  t jr tdd td| jj  | j  | jddddgd |   | j	  | jdd	dd
gd | 
| jjd | 
| jjd | j  | d| j | d| j | 
| jjd | 
| jjd | j  | 
| jjd | 
| jjd | d| j | d| j | j  | d| j | d| j |   | 
| jjd | 
| jjd | j  | d| j | d| j | 
| jjj ddg | 
| jjj dd
g | 
| jjjjd | 
| jjjjd | 
| jjd | 
| jjd dS )z!Checking twice ops and two marks.r1   r2   zRunning %s.test02_twice2...r3   r4   r5   r6   r7   rF   rG   rH   r   r8   rI   r   r   N)r	   r9   r:   r0   r;   r)   r<   r+   r   markr?   r@   rA   r=   rC   r>   rB   r*   r4   rD   rF   r   r   r   r   r   test02_twice2w   sF    






zBasicTestCase.test02_twice2c                 C   s  t jr tdd td| jj  | j  | jddddgd | jdd	dd
gd | j  | jddd
dgd | jddddgd | 	  | j  | jddddgd | jddddgd | j
  | d| j | d| j | d| j | d| j | d| j | d| j | j
  | d| j | d| j | d| j | d| j | d| j | d| j | j
  | d| j | d| j | d| j | d| j | d| j | d| j | 	  | j  | d| j | d| j | d| j | d| j | d| j | d| j | j  | d| j | d| j | d| j | d| j | d| j | d| j | j  | d| j | d| j | d| j | d| j | d| j | d| j | | jjj ddg | | jjj dd
g | | jjj d
dg | | jjj ddg | | jjj ddg | | jjj ddg | | jjjjd | | jjjjd | | jjjjd | | jjjjd | | jjjjd | | jjjjd dS )z&Checking with six ops and three marks.r1   r2   z!Running %s.test03_6times3marks...r3   otherarray1r5   r6   Another array 1rF   rG   rH   otherarray3   Another array 3otherarray4   Another array 4otherarray5   Another array 5otherarray6	   Another array 6/otherarray1rI   /otherarray3/otherarray4/otherarray5/otherarray6N)r	   r9   r:   r0   r;   r)   r<   r+   rK   r   r=   rC   r>   rB   r?   r*   rM   rD   rF   rO   rR   rU   rX   r   r   r   r   r   test03_6times3marks   s    









z!BasicTestCase.test03_6times3marksc                 C   s\  t jr tdd td| jj  | j  | jddddgd | jdd	dd
gd | j  | 	  | jddd
dgd | jddddgd | j
  | d| j | d| j | d| j | d| j t jrtd| j  | j  | 	  | jddddgd | jddddgd | d| j | d| j | d| j | d| j | d| j | d| j | j
  | d| j | d| j | d| j | d| j | d| j | d| j | j  | d| j | d| j | d| j | d| j | d| j | d| j | 	  | j  | d| j | d| j | d| j | d| j | d| j | d| j | | jjj ddg | | jjj dd
g | | jjj ddg | | jjj ddg | | jjjjd | | jjjjd | | jjjjd | | jjjjd dS ) zNChecking with six operations, three marks and do/undo in random
        order.r1   r2   z#Running %s.test04_6times3marksro...r3   rM   r5   r6   rN   rF   rG   rH   rO   rP   rQ   rR   rS   rT   r[   rI   r\   r]   z
All nodes:rU   rV   rW   rX   rY   rZ   r^   r_   N)r	   r9   r:   r0   r;   r)   r<   r+   rK   r   r=   rC   r>   Z
walk_nodesrB   r?   r*   rM   rD   rF   rU   rX   r   r   r   r   r   test04_6times3marksro	  sv    







z#BasicTestCase.test04_6times3marksroc                 C   s  t jr tdd td| jj  | j  | jddddgd | j  | 	  | jdd	dd
gd | j
  | 	  | jddd
dgd | d| j | | jjj ddg | | jjjjd | d| j | d| j | | jjj d
dg | | jjjjd dS )z/Checking with a destructive action during undo.r1   r2   z Running %s.test05_destructive...r3   rM   r5   r6   rN   rF   rG   rH   rO   rP   rQ   r[   rI   r\   N)r	   r9   r:   r0   r;   r)   r<   r+   rK   r   r=   rC   r?   r*   rM   rD   r   r>   rO   r   r   r   r   test05_destructiveX  s$    



z BasicTestCase.test05_destructivec                 C   s`  t jr tdd td| jj  | j  | jddddgd |   | j	  | jdd	dd
gd | j
  | jddd
dgd |   | j	  | jddddgd | d| j | j
  | d| j | | jjj ddg | | jjjjd | d| j | d| j | | jjj d
dg | | jjjjd | d| j dS )z3Checking with a destructive action during undo (II)r1   r2   z!Running %s.test05b_destructive...r3   rM   r5   r6   rN   rF   rG   rH   rO   rP   rQ   rR   rS   rT   r]   r[   rI   r\   N)r	   r9   r:   r0   r;   r)   r<   r+   r   rK   r=   rC   r?   r*   rM   rD   r   r>   rO   r   r   r   r   test05b_destructivez  s2    





z!BasicTestCase.test05b_destructivec                 C   s  t jr tdd td| jj  | j  | jddddgd | j  | 	  | jdd	dd
gd | j
  | jddd
dgd | j  | 	  | jddddgd | d| j | j
  | 	  | j
  | d| j | d| j | d| j | d| j dS )z4Checking with a destructive action during undo (III)r1   r2   z!Running %s.test05c_destructive...r3   rM   r5   r6   rN   rF   rG   rH   rO   rP   rQ   rR   rS   rT   r]   r[   rI   r\   N)r	   r9   r:   r0   r;   r)   r<   r+   rK   r   r=   rC   r>   r   r   r   r   test05c_destructive  s.    






z!BasicTestCase.test05c_destructivec                 C   s  t jr tdd td| jj  | j  | jddddgd |   | j	  | jdd	dd
gd | j
  | jddd
dgd | j	  | jddddgd | d| j |   | j
d | d| j | d| j | d| j | d| j dS )z3Checking with a destructive action during undo (IV)r1   r2   z!Running %s.test05d_destructive...r3   rM   r5   r6   rN   rF   rG   rH   rO   rP   rQ   rR   rS   rT   r]   r   r[   rI   r\   N)r	   r9   r:   r0   r;   r)   r<   r+   r   rK   r=   rC   r>   r   r   r   r   test05d_destructive  s*    




z!BasicTestCase.test05d_destructivec                 C   s   t jr tdd td| jj  | j  | jddddgd | j  | jdd	dd
gd | j	  | 
  | jddd
dgd | j	d | 
  | d| j | d| j | d| j dS )z2Checking with a destructive action during undo (V)r1   r2   z!Running %s.test05e_destructive...r3   rM   r5   r6   rN   rF   rG   rH   rO   rP   rQ   r   r[   rI   r\   N)r	   r9   r:   r0   r;   r)   r<   r+   rK   r=   r   r>   r   r   r   r   test05e_destructive  s"    



z!BasicTestCase.test05e_destructivec                 C   s   t jr tdd td| jj  | j  | jdddg | j  | 	  | 
d| j | jdddg}| j  | 
d| j | 	  | j  | d| j | js| | jjj| dS )	zAChecking with a destructive creation of existing node during undor1   r2   z!Running %s.test05f_destructive...r3   newarrayr   z	/newarrayN)r	   r9   r:   r0   r;   r)   r<   r+   r=   r   r>   rB   rC   r   assertIsr*   rg   )r   Znewarrr   r   r   test05f_destructive  s$    




z!BasicTestCase.test05f_destructivec                 C   s   t jr tdd td| jj  | j  | jddddgd | j  | jdd	dd
gd | 	  | j
d | d| j | d| j dS )zChecking do/undo (total unwind)r1   r2   z Running %s.test06_totalunwind...r3   r4   r5   r6   r7   rF   rG   rH   r   r8   rI   N)r	   r9   r:   r0   r;   r)   r<   r+   rK   r   r=   r>   r   r   r   r   test06_totalunwind0  s    


z BasicTestCase.test06_totalunwindc                 C   s   t jr tdd td| jj  | j  | jddddgd | j  | jdd	dd
gd | j	d | 
  | jd | d| j | d| j | | jjj ddg | | jjj dd
g | | jjjjd | | jjjjd dS )zChecking do/undo (total rewind)r1   r2   z Running %s.test07_totalunwind...r3   r4   r5   r6   r7   rF   rG   rH   r   r8   rI   N)r	   r9   r:   r0   r;   r)   r<   r+   rK   r=   r   rB   rC   r?   r*   r4   rD   rF   r   r   r   r   r   test07_totalrewindE  s     


z BasicTestCase.test07_totalrewindc                 C   s2  t jr tdd td| jj  | j  | jddddgd | jd	 | jdd
ddgd | jd | jddddgd | jd | jddddgd | j	d	 | 
  | d| j | d| j | d| j | d| j | jd | d| j | d| j | d| j | d| j | j	d | d| j | d| j | d| j | d| j | 
  | jd | d| j | d| j | d| j | d| j | | jjj ddg | | jjj ddg | | jjj ddg | | jjj ddg dS )zChecking mark names.r1   r2   zRunning %s.test08_marknames...r3   rM   r5   r6   rN   firstrF   rG   rH   secondrO   rP   rQ   thirdrR   rS   rT   r[   rI   r\   r]   rk   N)r	   r9   r:   r0   r;   r)   r<   r+   rK   r=   r   rC   r>   rB   r?   r*   rM   rD   rF   rO   rR   r   r   r   r   test08_marknamesc  sJ    

zBasicTestCase.test08_marknamesc                 C   s*  t jr tdd td| jj  | j  | j }| jddddgd | j	  | 
  | jdd	dd
gd | j| | d| j | d| j | jd | 
  | d| j | d| j | | jjj ddg | | jjj dd
g | | jjjjd | | jjjjd dS )zChecking initial mark.r1   r2   z Running %s.test08_initialmark...r3   r4   r5   r6   r7   rF   rG   rH   r8   rI   rk   N)r	   r9   r:   r0   r;   r)   r<   get_current_markr+   rK   r   r=   r>   rB   rC   r?   r*   r4   rD   rF   r   )r   Zinitmidr   r   r   test08_initialmark  s(    



z BasicTestCase.test08_initialmarkc                 C   s|  t jr tdd td| jj  | j  | jddddgd | jd	 | jdd
ddgd | jd | 	  | jddddgd | jd | jddddgd | j
d	 | tj | j
d W d   n1 s0    Y  | jd | 	  | tj | jd W d   n1 s60    Y  | d| j | d| j | d| j | d| j dS )z%Checking mark names (wrong direction)r1   r2   zRunning %s.test09_marknames...r3   rM   r5   r6   rN   rm   rF   rG   rH   rn   rO   rP   rQ   ro   rR   rS   rT   Nr[   rI   r\   r]   )r	   r9   r:   r0   r;   r)   r<   r+   rK   r   r=   assertRaisestablesZUndoRedoErrorrB   rC   r>   r   r   r   r   test09_marknames  s.    

*,zBasicTestCase.test09_marknamesc                 C   sH  t jr tdd td| jj  | j  | jddddgd |   | j	d	 | jdd
ddgd | j	d | jddddgd |   | j	d | jddddgd | j
d	 | d| j | d| j | d| j | d| j | j
d | d| j | d| j | d| j | d| j |   | j
d | d| j | d| j | d| j | d| j | j
d | d| j | d| j | d| j | d| j | d| j | | jjj ddg | | jjj ddg | | jjj ddg | | jjj ddg dS )zChecking mark names (goto)r1   r2   zRunning %s.test10_goto...r3   rM   r5   r6   rN   rm   rF   rG   rH   rn   rO   rP   rQ   ro   rR   rS   rT   r[   rI   r\   r]   rk   N)r	   r9   r:   r0   r;   r)   r<   r+   r   rK   gotorC   r>   r?   r*   rM   rD   rF   rO   rR   r   r   r   r   test10_goto  sN    

zBasicTestCase.test10_gotoc                 C   s  t jr tdd td| jj  | j  | jddddgd | jd	 | jdd
ddgd | jd | 	  | jddddgd | jd | jddddgd | j
d | 	  | d| j | d| j | d| j | d| j | j
d | d| j | d| j | d| j | d| j | 	  | j
d | d| j | d| j | d| j | d| j | j
d | d| j | d| j | d| j | d| j | 	  | j
d | d| j | d| j | d| j | d| j | d| j | | jjj ddg | | jjj ddg | | jjj ddg | | jjj ddg dS )z#Checking mark sequential ids (goto)r1   r2   zRunning %s.test10_gotoint...r3   rM   r5   r6   rN   rm   rF   rG   rH   rn   rO   rP   rQ   ro   rR   rS   rT   r   r[   rI   r\   r]   r   r   rk   N)r	   r9   r:   r0   r;   r)   r<   r+   rK   r   rv   rC   r>   r?   r*   rM   rD   rF   rO   rR   r   r   r   r   test10_gotoint  sZ    

zBasicTestCase.test10_gotointc                 C   s  t jr tdd td| jj  | j  | j }| j }| || | 	  | j
| | | j | | j| | | j | | j| | | j | | j| | | j | | jd | 	  | | j | | jd | | j d dS )zCreating contiguous marksr1   r2   zRunning %s.test11_contiguous...rk   r   N)r	   r9   r:   r0   r;   r)   r<   rK   ZassertNotEqualr   r=   r?   rq   rB   rv   )r   Zm1Zm2r   r   r   test11_contiguous_  s*    



zBasicTestCase.test11_contiguousc                 C   s   t jr tdd td| jj  | j  | jdddg | j }| 	| | 
  | j  | | j d | d| j d	S )
z1Ensuring the mark is kept after an UNDO operationr1   r2   zRunning %s.test12_keepMark...r3   	newarray1r   r   
/newarray1N)r	   r9   r:   r0   r;   r)   r<   r+   rK   assertIsNotNoner   r=   r?   rq   r>   r   Zmidr   r   r   test12_keepMarky  s    




zBasicTestCase.test12_keepMarkc                 C   s  t jr tdd td| jj  | j  | jdddg | j  | 	  | 
| j d | d| j | j  | jdd	dg | j  | jdd
dg | j }| jdddg | j  | 
| j | | d| j | d| j | d| j | d| j | 	  | j  | j  | jdddg | jdddg | d| j | d| j | d| j | d| j | j  | 	  | d| j | d| j | d| j | d| j | j  dS )z2Checking that successive enable/disable Undo worksr1   r2   z)Running %s.test13_severalEnableDisable...r3   rz   r   r   r{   Z	newarray2Z	newarray3Z	newarray4z
/newarray2z
/newarray3z
/newarray4N)r	   r9   r:   r0   r;   r)   r<   r+   r=   r   r?   rq   r>   Zdisable_undorK   rC   r}   r   r   r   test13_severalEnableDisable  sN    









z)BasicTestCase.test13_severalEnableDisable)r;   
__module____qualname____doc__r   r   r(   rE   rJ   rL   r`   ra   rb   rc   rd   re   rf   ri   rj   rl   rp   rr   ru   rw   rx   ry   r~   r   __classcell__r   r   r/   r   r      s2   "#5]O",*("7")9Ar   c                   @   s   e Zd ZdZdZdS )PersistenceTestCasez5Test for basic Undo/Redo operations with persistence.TN)r;   r   r   r   r   r   r   r   r   r     s   r   c                       s@   e Zd ZdZ fddZdd Zdd Zdd	 Zd
d Z  Z	S )CreateArrayTestCasez Test for create_array operationsc                    s   t t|   | j}|j}|j|dddgdd ||ddgd ||dd	}||d
dgd ||ddgd ||dd ||dd d S r   )r'   r   r(   r)   r*   r+   r,   r-   r/   r   r   r(     s    zCreateArrayTestCase.setUpc                 C   s   t jr tdd td| jj  | j  | jddddgd | j  | 	d	| j | j
  | d	| j | | jjjjd | | jjj ddg d
S )Checking one action.r1   r2   Running %s.test00...r3   rM   r   r   rN   r[   N)r	   r9   r:   r0   r;   r)   r<   r+   r=   r>   rB   rC   r?   r*   rM   r   rD   r   r   r   r   test00  s    



zCreateArrayTestCase.test00c                 C   s  t jr tdd td| jj  | j  | jddddgd | jdd	dd
gd | j  | 	d| j | 	d| j | j
  | d| j | d| j | | jjjjd | | jjjjd | | jjj ddg | | jjj dd
g dS )Checking two actions.r1   r2   Running %s.test01...r3   rM   r   r   rN   rF   r5   rH   r[   rI   N)r	   r9   r:   r0   r;   r)   r<   r+   r=   r>   rB   rC   r?   r*   rM   r   rF   rD   r   r   r   r   test01  s     



zCreateArrayTestCase.test01c                 C   sb  t jr tdd td| jj  | j  | jddddgd | jdd	dd
gd | jddd
dgd | j  | 	d| j | 	d| j | 	d| j | j
  | d| j | d| j | d| j | | jjjjd | | jjjjd | | jjjjd | | jjj ddg | | jjj dd
g | | jjj d
dg dS )Checking three actions.r1   r2   Running %s.test02...r3   rM   r   r   rN   rF   r5   rH   rO   r6   rQ   r[   rI   r\   N)r	   r9   r:   r0   r;   r)   r<   r+   r=   r>   rB   rC   r?   r*   rM   r   rF   rO   rD   r   r   r   r   test02-  s*    



zCreateArrayTestCase.test02c                 C   sn  t jr tdd td| jj  | j  | jddddgd | jd	d
ddgd | jddddgd | j  | 	d| j | 	d| j | 	d| j | j
  | d| j | d| j | d| j | | jjjjd | | jjjjjd | | jjjjjjd | | jjj ddg | | jjjj ddg | | jjjjj ddg dS )1Checking three actions in different depth levels.r1   r2   Running %s.test03...r3   rM   r   r   rN   /agrouprF   r5   rH   /agroup/agroup3rO   r6   rQ   r[   z/agroup/otherarray2z/agroup/agroup3/otherarray3N)r	   r9   r:   r0   r;   r)   r<   r+   r=   r>   rB   rC   r?   r*   rM   r   r   rF   r%   rO   rD   r   r   r   r   test03R  s>    





zCreateArrayTestCase.test03
r;   r   r   r   r(   r   r   r   r   r   r   r   r/   r   r     s    %r   c                       s@   e Zd ZdZ fddZdd Zdd Zdd	 Zd
d Z  Z	S )CreateGroupTestCasez Test for create_group operationsc                    s   t t|   | j}|j}|j|dddgdd ||ddgd ||dd	}||d
dgd ||ddgd ||dd ||dd d S r   )r'   r   r(   r)   r*   r+   r,   r-   r/   r   r   r(     s    zCreateGroupTestCase.setUpc                 C   s   t jr tdd td| jj  | j  | jddd | j  | 	d| j | j
  | d| j | | jjjjd dS )	r   r1   r2   r   r3   othergroup1Another group 1/othergroup1N)r	   r9   r:   r0   r;   r)   r<   r,   r=   r>   rB   rC   r?   r*   r   _v_titler   r   r   r   r     s    



zCreateGroupTestCase.test00c                 C   s   t jr tdd td| jj  | j  | jddd | jddd | j  | 	d	| j | 	d
| j | j
  | d	| j | d
| j | | jjjjd | | jjjjd dS )r   r1   r2   r   r3   r   r   othergroup2Another group 2r   /othergroup2N)r	   r9   r:   r0   r;   r)   r<   r,   r=   r>   rB   rC   r?   r*   r   r   r   r   r   r   r   r     s$    



zCreateGroupTestCase.test01c                 C   s  t jr tdd td| jj  | j  | jddd | jddd | jdd	d
 | j  | 	d| j | 	d| j | 	d| j | j
  | d| j | d| j | d| j | | jjjjd | | jjjjd | | jjjjd
 dS )r   r1   r2   r   r3   r   r   r   r   othergroup3Another group 3r   r   z/othergroup3N)r	   r9   r:   r0   r;   r)   r<   r,   r=   r>   rB   rC   r?   r*   r   r   r   r   r   r   r   r   r     s0    



zCreateGroupTestCase.test02c                 C   s
  t jr tdd td| jj  | j  | jddd | jddd	 | jd
dd | j  | 	d| j | 	d
| j | 
d| jv | j  | d| j | d
| j | d| j | | jjjjd | | jjjjjd	 | | jjjjjjd dS )r   r1   r2   r   r3   r   r   r   r   r   z/othergroup1/othergroup2r   r   z$/othergroup1/othergroup2/othergroup3N)r	   r9   r:   r0   r;   r)   r<   r,   r=   r>   
assertTruerB   rC   r?   r*   r   r   r   r   r   r   r   r   r     s>    



zCreateGroupTestCase.test03r   r   r   r/   r   r   }  s    %r   
   c                 C   s   G dd dt }t}| j| ||dd|}t|D ]J}t||jd< |d |jd< ||jd< t|| d |jd	< |j  q2|	  |j
j }|j
j }|j
j }tjrtd
| td|j
jjj td| dS )z)Create a table under where with name namec                   @   s>   e Zd ZeddddZedddZedddZe	dddZ
d	S )
zpopulateTable.<locals>.Indexedr6       r   )itemsizedfltposr   r   )r   r   r5   N)r;   r   r   r   var1r   var2r   var3r   var4r   r   r   r   Indexed)  s   r   Nr   r   r   r   r   r   zNumber of written rows:zNumber of indexed rows:zNumber of indexed rows(2):)r   minRowIndexZ_v_fileZcreate_tablerangestrrowfloatappendflushcolsr   Zcreate_indexr   r   r	   r9   r:   index	nelements)wherenamer   ZnrowstableiZ	indexrowsr   r   r   populateTable&  s&    

r   c                       sH   e Zd ZdZ fddZdd Zdd Zdd	 Zd
d Zdd Z	  Z
S )RenameNodeTestCasezTest for rename_node operationsc                    s   t t|   | j}|j}|j|dddgdd ||ddgd ||dd	}||d
dgd ||ddgd ||dd ||dd t| jjd d S Nr   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(   L  s    zRenameNodeTestCase.setUpc                 C   s   t jr tdd td| jj  | j  | jdd | j  | 	d| j | 
d| j | | jjjjd | j  | 
d| j | 	d| j | | jjjjd dS )	z3Checking rename_node (over Groups without children)r1   r2   r   /agroup2r%   /agroup3r$   N)r	   r9   r:   r0   r;   r)   r<   rename_noder=   rC   r>   r?   r*   r#   r   rB   r%   r   r   r   r   r   h  s    



zRenameNodeTestCase.test00c                 C   s  t jr tdd td| jj  | j  | jdd | j  | 	d| j | 
d| j | 	d| j | 	d| j | 	d	| j | | jjjjd
 | j  | 
d| j | 	d| j | | jjjjd
 | 	d| j | 	d| j | 	d| j dS )z0Checking rename_node (over Groups with children)r1   r2   r   r   r%   r   /agroup/anarray1/agroup/anarray2r   r   z/agroup3/anarray1z/agroup3/anarray2z/agroup3/agroup3N)r	   r9   r:   r0   r;   r)   r<   r   r=   rC   r>   r?   r*   r   r   rB   r%   r   r   r   r   r     s&    



zRenameNodeTestCase.test01c                 C   s  t jr tdd td| jj  | j  | jdd | jdd | j  | 	d| j | 
d| j | 	d	| j | 	d
| j | 	d| j | | jjjjd | j  | 
d| j | 	d| j | | jjjjd | 	d| j | 	d| j | 	d| j dS )z2Checking rename_node (over Groups with children 2)r1   r2   Running %s.test01b...r   r%   r   agroup4z/agroup4r   r   r   r   z/agroup4/anarray1z/agroup4/anarray2z/agroup4/agroup3N)r	   r9   r:   r0   r;   r)   r<   r   r=   rC   r>   r?   r*   r   r   rB   r   r   r   r   r   test01b  s(    



zRenameNodeTestCase.test01bc                 C   s   t jr tdd td| jj  | j  | jdd | j  | 	d| j | 
d| j | | jjjjd | j  | 
d| j | 	d| j | | jjjjd dS )	z"Checking rename_node (over Leaves)r1   r2   r   /anarrayr!   z	/anarray2r   N)r	   r9   r:   r0   r;   r)   r<   r   r=   rC   r>   r?   r*   r   r   rB   r!   r   r   r   r   r     s    



zRenameNodeTestCase.test02c                 C   s  t jr tdd td| jj  | j  | jdd | j  | 	d| j | jj
j}| |jjj | |jjj | |jjj | |jjj | |jjjjt | |jjjjt | |jjjjt | d| j | | jj
jjd | j  | d| j | 	d| j | | jj
jjd | jj
j}| |jjj | |jjj | |jjj | |jjjjt | |jjjjt | |jjjjt | |jjj dS )	z"Checking rename_node (over Tables)r1   r2   r   /tabletable2z/table2r   N)r	   r9   r:   r0   r;   r)   r<   r   r=   rC   r*   r   r|   r   r   r   r   r   assertIsNoner   r?   r   r   r>   r   rB   r   r   r   r   r   r   r     s:    





zRenameNodeTestCase.test03r;   r   r   r   r(   r   r   r   r   r   r   r   r   r/   r   r   I  s   '(r   c                       sH   e Zd ZdZ fddZdd Zdd Zdd	 Zd
d Zdd Z	  Z
S )MoveNodeTestCasezTests for move_node operationsc                    s   t t|   | j}|j}|j|dddgdd ||ddgd ||dd	}||d
dgd ||ddgd ||dd ||dd t| jjd d S r   )r'   r   r(   r)   r*   r+   r,   r   r-   r/   r   r   r(   "  s    zMoveNodeTestCase.setUpc                 C   s   t jr tdd td| jj  | j  | jdd | j  | 	d| j | 
d| j | | jjjjd | j  | 
d| j | 	d| j | | jjjjjjd dS )	zChecking move_node (over Leaf)r1   r2   r   r   r   /agroup/agroup3/anarrayr   N)r	   r9   r:   r0   r;   r)   r<   	move_noder=   rC   r>   r?   r*   r   r   rB   r   r%   r   r   r   r   r   >  s    



zMoveNodeTestCase.test00c                 C   s  t jr tdd td| jj  | j  | jddd | j  | 	d| j | 
d| j | 	d| j | 	d	| j | 	d
| j | | jjjjd | j  | 
d| j | 	d| j | | jjjjjd | 	d| j | 	d| j | 	d| j dS )z.Checking move_node (over Groups with children)r1   r2   r   r   r   r%   /agroup2/agroup3r   r   r   r   z/agroup2/agroup3/anarray1z/agroup2/agroup3/anarray2z/agroup2/agroup3/agroup3N)r	   r9   r:   r0   r;   r)   r<   r   r=   rC   r>   r?   r*   r   r   rB   r#   r%   r   r   r   r   r   \  s*    



zMoveNodeTestCase.test01c                 C   s  t jr tdd td| jj  | j  | jddd | jddd	 | j  | 	d| j | 
d
| j | 	d| j | 	d| j | 	d| j | | jjjjd | j  | 
d| j | 	d
| j | | jjjjjd | 	d| j | 	d| j | 	d| j dS )z0Checking move_node (over Groups with children 2)r1   r2   r   r   r3   r%   r   r   r   z/agroup2/agroup4r   r   r   r   z/agroup2/agroup4/anarray1z/agroup2/agroup4/anarray2z/agroup2/agroup4/agroup3N)r	   r9   r:   r0   r;   r)   r<   r   r=   rC   r>   r?   r*   r   r   rB   r#   r   r   r   r   r   r     s,    



zMoveNodeTestCase.test01bc                 C   s   t jr tdd td| jj  | j  | jddd | j  | 	d| j | 
d| j | | jjjjd | j  | 
d| j | 	d| j | | jjjjjd d	S )
z Checking move_node (over Leaves)r1   r2   r   r   r   r!   /agroup2/anarray2r   N)r	   r9   r:   r0   r;   r)   r<   r   r=   rC   r>   r?   r*   r   r   rB   r#   r!   r   r   r   r   r     s    



zMoveNodeTestCase.test02c                 C   s  t jr tdd td| jj  | j  | jddd | j  | 	d| j | 
d| j | jjj}| |jjj | |jjj | |jjj | |jjj | |jjjjt | |jjjjt | |jjjjt | | jjjjd | j  | 
d| j | 	d| j | | jjjjjd | jjjj}| |jjj | |jjj | |jjj | |jjjjt | |jjjjt | |jjjjt | |jjj d	S )
z Checking move_node (over Tables)r1   r2   r   r   r   r   z/agroup2/table2r   N)r	   r9   r:   r0   r;   r)   r<   r   r=   rC   r>   r*   r   r|   r   r   r   r   r   r   r   r?   r   r   r   rB   r#   r   r   r   r   r   r     s:    




zMoveNodeTestCase.test03r   r   r   r/   r   r     s   ()r   c                       sH   e Zd ZdZ fddZdd Zdd Zdd	 Zd
d Zdd Z	  Z
S )RemoveNodeTestCasezTest for remove_node operationsc                    s   t t|   | j}|j}|j|dddgdd ||ddgd ||dd	}||d
dgd ||ddgd ||dd ||dd t| jjd d S r   )r'   r   r(   r)   r*   r+   r,   r   r-   r/   r   r   r(     s    zRemoveNodeTestCase.setUpc                 C   s~   t jr tdd td| jj  | j  | jd | j  | 	d| j | 
| jjjjd | j  | d| j dS )z Checking remove_node (over Leaf)r1   r2   r   r   r   N)r	   r9   r:   r0   r;   r)   r<   remove_noder=   rC   r?   r*   r   r   rB   r>   r   r   r   r   r     s    



zRemoveNodeTestCase.test00c                 C   s   t jr tdd td| jj  | j  | jd | jd | j  | 	d| j | 	d| j | 
| jjjjd | 
| jjjjjd | j  | d| j | d| j dS )	z*Checking remove_node (over several Leaves)r1   r2   zRunning %s.test00b...r   r   r   r"   N)r	   r9   r:   r0   r;   r)   r<   r   r=   rC   r?   r*   r   r   r   r!   rB   r>   r   r   r   r   test00b2  s     



zRemoveNodeTestCase.test00bc                 C   s  t jr tdd td| jj  | j  | jd | j  | 	d| j | jj
j}| |jjj | |jjj | |jjj | |jjj | |jjjjt | |jjjjt | |jjjjt | | jj
jjd | j  | d| j dS )z"Checking remove_node (over Tables)r1   r2   zRunning %s.test00c...r   r   N)r	   r9   r:   r0   r;   r)   r<   r   r=   rC   r*   r   r|   r   r   r   r   r   r   r   r?   r   r   r   rB   r>   r   r   r   r   test00cQ  s$    




zRemoveNodeTestCase.test00cc                 C   s   t jr tdd td| jj  | j  | jjddd | j  | 	d| j | 	d| j | 	d| j | 	d	| j | 
| jjjjd
 | j  | d| j | d| j | d| j | d	| j dS )z0Checking remove_node (over Groups with children)r1   r2   r   r   r   	recursiver   r   r   r   Nr	   r9   r:   r0   r;   r)   r<   r   r=   rC   r?   r*   r   r   rB   r>   r   r   r   r   r   s  s     



zRemoveNodeTestCase.test01c                 C   s   t jr tdd td| jj  | j  | jjddd | jd | j  | 	d| j | 	d| j | 	d| j | 	d	| j | 	d
| j | 
| jjjjd | j  | d| j | d| j | d| j | d	| j | d
| j dS )z2Checking remove_node (over Groups with children 2)r1   r2   r   r   r   r   r   r   r   r   r   Nr   r   r   r   r   r     s&    



zRemoveNodeTestCase.test01b)r;   r   r   r   r(   r   r   r   r   r   r   r   r   r/   r   r     s   " r   c                       sH   e Zd ZdZ fddZdd Zdd Zdd	 Zd
d Zdd Z	  Z
S )CopyNodeTestCasez0Tests for copy_node and copy_children operationsc                    s   t t|   | j}|j}|j|dddgdd ||ddgd ||dd	}||d
dgd ||ddgd ||dd ||dd t| jjd d S r   )r'   r   r(   r)   r*   r+   r,   r   r-   r/   r   r   r(     s    zCopyNodeTestCase.setUpc                 C   s   t jr tdd td| jj  | j  | jdd}| j  | 	d| j | j
  | d| j | | jjjjj| dS )z Checking copy_node (over Leaves)r1   r2   zRunning %s.test00_copyLeaf...r   r   r   N)r	   r9   r:   r0   r;   r)   r<   	copy_noder=   r>   rB   rC   rh   r*   r   r%   r   r   new_noder   r   r   test00_copyLeaf  s    



z CopyNodeTestCase.test00_copyLeafc                 C   s^  t jr tdd td| jj  | j  tjdt	d | jj
dddd	}tjd
t	d | d| j | jjjjj}| |jd | |jjj | |jjj | |jjj | |jjjjt | |jjjjt | |jjjjt | |jjj | j  | jjj}| |jjj | |jjj | |jjj | |jjj | |jjjjt | |jjjjt | |jjjjt | d| j | j  | d| j | d| j | jjjjj}| |jd | |jjj | |jjj | |jjj | |jjjjt | |jjjjt | |jjjjt | |jjj dS )z Checking copy_node (over Tables)r1   r2   zRunning %s.test00b_copyTable...ignore)categoryr   r   T)Zpropindexesdefaultz/agroup/agroup3/tabler   N)r	   r9   r:   r0   r;   r)   r<   warningsfilterwarningsUserWarningr   rC   r*   r   r%   r   r?   r   r|   r   r   r   r   r   r   r   r   r   r=   r>   rB   r   r   r   r   test00b_copyTable  sR    




z"CopyNodeTestCase.test00b_copyTablec                 C   s   t jr tdd td| jj  | j  | jjdddd}| j  | 	d| j | 	d	| j | 	d
| j | 	d| j | j
  | d| j | d	| j | d
| j | d| j | | jjj| dS )zCopying a group (recursively).r1   r2   zRunning %s.test01_copyGroup...r   acopyT)newnamer   z/acopyz/acopy/anarray1z/acopy/anarray2z/acopy/agroup3N)r	   r9   r:   r0   r;   r)   r<   r   r=   r>   rB   rC   rh   r*   r   r   r   r   r   test01_copyGroup-  s$    



z!CopyNodeTestCase.test01_copyGroupc                 C   s   t jr tdd td| jj  | j  | jjj}| jj	dddd}| j
  | | jjj| | j  | | jjj| dS )	z(Copying a leaf, overwriting destination.r1   r2   z&Running %s.test02_copyLeafOverwrite...r   r   T)r   Z	overwriteN)r	   r9   r:   r0   r;   r)   r<   r*   r   r   r=   rh   rB   )r   ZoldNoder   r   r   r   test02_copyLeafOverwriteN  s    




z)CopyNodeTestCase.test02_copyLeafOverwritec                 C   s   t jr tdd td| jj  | j  | jjdddd | j  | 	d| j | 	d	| j | 	d
| j | j
  | d| j | d	| j | d
| j dS )zCopying the children of a groupr1   r2   z!Running %s.test03_copyChildren...r   r   Tr   z/agroup2/anarray1r   r   N)r	   r9   r:   r0   r;   r)   r<   copy_childrenr=   r>   rB   rC   r   r   r   r   test03_copyChildrenl  s    



z$CopyNodeTestCase.test03_copyChildren)r;   r   r   r   r(   r   r   r   r   r   r   r   r   r/   r   r     s   9!r   c                       sH   e Zd ZdZ fddZdd Zdd Zdd	 Zd
d Zdd Z	  Z
S )ComplexTestCasez!Tests for a mix of all operationsc                    s   t t|   | j}|j}|j|dddgdd ||ddgd ||dd	}||d
dgd ||ddgd ||dd ||dd d S r   )r'   r   r(   r)   r*   r+   r,   r-   r/   r   r   r(     s    zComplexTestCase.setUpc                 C   sr  t jr tdd td| jj  | j  | j| jjddgd | j	| jjdd | j
d	d
}| jjdddd}| jdd | j
d	d}| jd | j  | d| j | d	| j | d| j | d| j | d| j | d| j | j  | d| j | d| j | d| j | d| j | | jjjj| | d| j | d| j dS )zkMix of create_array, create_group, renameNone, move_node,
        remove_node, copy_node and copy_children.r1   r2   r   anarray3r   Array title 3r%   r&   z	/anarray3r   r   r   r   r   Zanarray4z	/anarray4z/agroup/agroup3/anarray3z/agroup/anarray3z/agroup3/agroup3/anarray3z/agroup3/anarray3N)r	   r9   r:   r0   r;   r)   r<   r+   r*   r,   r   r   r   r   r=   r>   rC   rB   rh   r   r   r   r   r   r   r     s<    



zComplexTestCase.test00c                 C   s  t jr tdd td| jj  | j  | jd | j| jj	ddgd | jd | j| jj	ddgd	 | jd | j| jj	dd
gd | j
  | | jj	jjd | | jj	jdd dg | j  | | jj	jjd | | jj	jdd d
g dS )z*Test with multiple generations (Leaf case)r1   r2   r   r   r   r   r"   r5   r   r6   zArray title 4r   Nr   )r	   r9   r:   r0   r;   r)   r<   r   r+   r*   r=   r?   r   r   rB   r   r   r   r   r     s,    



zComplexTestCase.test01c                 C   s  t jr tdd td| jj  | j  | jd | j| jj	dd | jd | j| jj	dd | jd | j| jj	dd | j| jj	j
d	d
 | j  | | jj	j
jd | d| j | j  | | jj	j
jd | | jj	j
jjd
 dS )z+Test with multiple generations (Group case)r1   r2   r   r   r#   zGroup title 22r&   Group title 4agroup5Group title 5r$   N)r	   r9   r:   r0   r;   r)   r<   r   r,   r*   r#   r=   r?   r   rC   rB   r   r   r   r   r   r   	  s*    



zComplexTestCase.test02c                 C   s\  t jr tdd td| jj  | j  | jjddd | j| jj	dd | jd | j| jj	dd	 | jd | j| jj	dd
 | j| jj	j
dd | j  | d| j | | jj	j
jd | d| j | d| j | d| j | d| j | j  | d| j | | jj	j
jd
 | d| j | | jj	j
jjd dS )z=Test with multiple generations (Group case, recursive remove)r1   r2   r   r   r   r   r   r$   r&   r   r   r   r   r   r   r   z/agroup/agroup5N)r	   r9   r:   r0   r;   r)   r<   r   r,   r*   r   r=   rC   r?   r   r>   rB   r   r   r   r   r   r   0	  s6    



zComplexTestCase.test03c                 C   s   t jr tdd td| jj  | j  | j| jjdd | j| jjj	dd | jj
dd	d
 | j| jjdd | j  | d| j | j  | | jjj	jd | d| j | d| j dS )zMTest with multiple generations (Group case, recursive remove,
        case 2)r1   r2   zRunning %s.test03b...r%   r&   r   r   r   r   r   z/agroup/agroup4N)r	   r9   r:   r0   r;   r)   r<   r,   r*   r%   r   r=   r>   rB   r?   r   rC   r   r   r   r   test03bb	  s     



zComplexTestCase.test03b)r;   r   r   r   r(   r   r   r   r   r   r   r   r   r/   r   r     s   4(-2r   c                       sH   e Zd ZdZ fddZdd Zdd Zdd	 Zd
d Zdd Z	  Z
S )AttributesTestCasez!Tests for operation on attributesc                    s>   t t|   | jddddg}|j}d|_d|_d|_d S )Nr3   r   r   r   r         )	r'   r   r(   r)   r+   attrsattr_1attr_2attr_3r   r   r   r/   r   r   r(   	  s    zAttributesTestCase.setUpc                 C   s   t jr tdd td| jj  | jjj}|j}| j	  t
|dd | d| | |jd | j  | d| | j  | d| | |jd dS )zSetting a nonexistent attributer1   r2   zRunning %s.test00_setAttr...attr_0r   N)r	   r9   r:   r0   r;   r)   r*   r   r   r<   setattrrC   r?   r   r=   r>   rB   r   r   r   r   test00_setAttr	  s    




z!AttributesTestCase.test00_setAttrc                 C   s   t jr tdd td| jj  | jjj}|j}| j	  t
|dd | d| | |jd | j  | d| | |jd | j  | d| | |jd dS )zSetting an existing attributer1   r2   z$Running %s.test01_setAttrExisting...r      r   N)r	   r9   r:   r0   r;   r)   r*   r   r   r<   r   rC   r?   r   r=   rB   r   r   r   r   test01_setAttrExisting	  s"    




z)AttributesTestCase.test01_setAttrExistingc                 C   s   t jr tdd td| jj  | jjj}|j}| j	  t
|d | d| | j  | d| | |jd | j  | d| dS )zRemoving an attributer1   r2   zRunning %s.test02_delAttr...r   r   N)r	   r9   r:   r0   r;   r)   r*   r   r   r<   delattrr>   r=   rC   r?   r   rB   r   r   r   r   test02_delAttr	  s    





z!AttributesTestCase.test02_delAttrc                 C   s  t jr tdd td| jj  | jjj}d|_d|_	| jjj
}|j}| j  || jj | |jd | |j	d | |jd | |jd | j  | |jd | |j	d | d	| | d
| | j  | |jd | |j	d | |jd | |jd dS )zCopying an attribute setr1   r2   z"Running %s.test03_copyNodeAttrs...r   d   r   r   r   r   r   N)r	   r9   r:   r0   r;   r)   r*   _v_attrsr   r   r   r   r<   Z_f_copyr?   r   r   r=   r>   rB   )r   Zrattrsr   r   r   r   r   test03_copyNodeAttrs	  s4    





z'AttributesTestCase.test03_copyNodeAttrsc                 C   s   t jr tdd td| jj  | jjj}|j}| j	  d|_
| jd | jdddg}d	|j_
| j  | d
| jjjj | | jjjjj
d | j  | d
| jjjj | | jjjjj
d	 dS )z+Replacing a node with a rewritten attributer1   r2   z Running %s.test04_replaceNode...r   /arrayr3   r   r      r   r   N)r	   r9   r:   r0   r;   r)   r*   r   r   r<   r   r   r+   r=   rC   r?   rB   )r   r   r   arrr   r   r   test04_replaceNode	  s     




z%AttributesTestCase.test04_replaceNode)r;   r   r   r   r(   r   r   r   r   r  r   r   r   r/   r   r   	  s    r   c                   @   s4   e Zd ZdZG dd deejZdd Zdd Z	dS )	NotLoggedTestCasezTest not logged nodes.c                   @   s   e Zd ZdS )z NotLoggedTestCase.NotLoggedArrayN)r;   r   r   r   r   r   r   NotLoggedArray
  s   r  c                 C   s   | j dd | j   | | j jddg|  }| j   | d| j  |d | j   | d| j  |	  | j   | 
d| j  dS )	z5Performing hierarchy operations on a not logged node.r3   Ztgrouptestr   z/testz/tgroupz/tgroup/testN)r)   r,   r<   r  r*   _getMethodNamer=   rC   Zmoveremover>   r   r  r   r   r   test00_hierarchy
  s    





z"NotLoggedTestCase.test00_hierarchyc                 C   s   |  | jjddg|  }| j  d|j_| j  | |jjd d|j_| j  | |jjd |j`| j  | 	t
t|jd dS )z5Performing attribute operations on a not logged node.r  r   ZbarZbazfooN)r  r)   r*   r  r<   r   r  r=   r?   rs   AttributeErrorgetattrr	  r   r   r   test01_attributes$
  s    




z#NotLoggedTestCase.test01_attributesN)
r;   r   r   r   r   rt   ZArrayr  r
  r  r   r   r   r   r  
  s   r  c                       sP   e Zd ZdZ fddZdd Zdd Zdd	 Zd
d Zdd Z	dd Z
  ZS )CreateParentsTestCasez Test the ``createparents`` flag.c                    s.   t t|   | jdd}| j|d d S )Nr3   g1Zg2)r'   r  r(   r)   r,   )r   r  r/   r   r   r(   >
  s    zCreateParentsTestCase.setUpc                    s   t  fdd|D S )z.Return a set of the existing paths in `paths`.c                 3   s   | ]}| j v r|V  qd S N)r)   ).0pathr   r   r   	<genexpr>E
  r   z1CreateParentsTestCase.existing.<locals>.<genexpr>)	frozenset)r   pathsr   r   r   existingC
  s    zCreateParentsTestCase.existingc                 C   sz   |  | j   g d}|D ]X}| |}|| | |}| || | j   || | |}| || qd S )N)z/g1z/g1/g2z	/g1/g2/g3z/g1/g2/g3/g4)r)   r<   r  r   
issupersetr=   r?   )r   doitprepostr  newpathZbeforeZafterr   r   r   basetestG
  s    




zCreateParentsTestCase.basetestc                    s2   dd } fdd} fdd}  ||| dS )zTest creating a node.c                   S   s   d S r  r   r   r   r   r   r  Z
  s    z0CreateParentsTestCase.test00_create.<locals>.prec                    s.    j j| ddgdd  t| d j  d S )Nr   r   TZcreateparents)r)   r+   rC   r   r  r   r   r   r  ]
  s    z1CreateParentsTestCase.test00_create.<locals>.doitc                    s     t| d j d S Nr   r>   r   r)   r  r   r   r   r  a
  s    z1CreateParentsTestCase.test00_create.<locals>.postNr  r   r  r  r  r   r   r   test00_createW
  s    z#CreateParentsTestCase.test00_createc                    s6    fdd} fdd} fdd}  ||| dS )zTest moving a node.c                      s    j dddg d S Nr3   r   r   r)   r+   r   r   r   r   r  h
  s    z.CreateParentsTestCase.test01_move.<locals>.prec                    s8    j jd| dd  d j   t| d j  d S Nr   Tr  r   )r)   r   r>   rC   r   r  r   r   r   r  k
  s    z/CreateParentsTestCase.test01_move.<locals>.doitc                    s&     d j  t| d j d S )Nr   r   )rC   r)   r>   r   r  r   r   r   r  p
  s    z/CreateParentsTestCase.test01_move.<locals>.postNr"  r#  r   r   r   test01_movee
  s    z!CreateParentsTestCase.test01_movec                    s6    fdd} fdd} fdd}  ||| dS )zTest copying a node.c                      s    j dddg d S r%  r&  r   r   r   r   r  x
  s    z.CreateParentsTestCase.test02_copy.<locals>.prec                    s*    j jd| dd  t| d j  d S r'  )r)   r   rC   r   r  r   r   r   r  {
  s    z/CreateParentsTestCase.test02_copy.<locals>.doitc                    s     t| d j d S r   r!  r  r   r   r   r  
  s    z/CreateParentsTestCase.test02_copy.<locals>.postNr"  r#  r   r   r   test02_copyu
  s    z!CreateParentsTestCase.test02_copyc                    s6    fdd} fdd} fdd}  ||| dS )z%Test copying the children of a group.c                     s6    j dd}  j | ddg  j | ddg d S )Nr3   r.   array1r   array2)r)   r,   r+   )gr   r   r   r  
  s    z6CreateParentsTestCase.test03_copyChildren.<locals>.prec                    s>    j jd| dd  t| d j   t| d j  d S )Nz/groupTr  r*  r+  )r)   r   rC   r   r  r   r   r   r  
  s    z7CreateParentsTestCase.test03_copyChildren.<locals>.doitc                    s,     t| d j   t| d j d S )Nr*  r+  r!  r  r   r   r   r  
  s    z7CreateParentsTestCase.test03_copyChildren.<locals>.postNr"  r#  r   r   r   r   
  s    z)CreateParentsTestCase.test03_copyChildren)r;   r   r   r   r(   r  r  r$  r(  r)  r   r   r   r   r/   r   r  ;
  s   r  c                  C   s   t  } d}t|D ]}| t t | t t | t t | t t | t t	 | t t
 | t t | t t | t t | t t | t t | t t qtjr| S )Nr   )r
   Z	TestSuiter   ZaddTestZ	makeSuiter   r   r   r   r   r   r   r   r   r   r  r  r	   Zheavy)ZtheSuiteZniternr   r   r   suite
  s"    r.  __main__)ZdefaultTest)'r   rt   r   r   r   r   r   Ztables.noder   Ztables.pathr   Ztables.testsr	   Ztables.tests.commonr
   r   ZTestCaseZTempFileMixinr   r   r   r   r   r   r   r   r   r   r   r   r  r  r.  r;   sysZ
parse_argvargvZprint_versionsmainr   r   r   r   <module>   sT          H ( '# W [ C Q { 3[
