3
ฮ้dC  ใ               @   sH   d Z ddlZddlZddlmZmZmZ G dd dZG dd dZdS )	zC
Testing copy and deepcopy, instigated by Issue 84 (Peter Amstutz)
้    N้   )ฺdedentฺround_trip_loadฺround_trip_dumpc               @   s$   e Zd Zdd Zdd Zdd ZdS )ฺTestDeepCopyc             C   sf   t d}t|}tj|}t|}tdj| tdj| ||ksJt|jj	 |jj	 ksbtd S )Nz&        {foo: bar, baz: quux}
        zx [{}]zy [{}])
r   r   ฺcopyฺdeepcopyr   ฺprintฺformatฺAssertionErrorฺfaฺ
flow_style)ฺselfฺxฺdataฺ	data_copyฺyฉ r   ๚U/var/www/html/virt/lib64/python3.6/site-packages/srsly/tests/ruamel_yaml/test_copy.pyฺtest_preserve_flow_style_simple   s    
z,TestDeepCopy.test_preserve_flow_style_simplec             C   sิ   t d}t|}|d jj dks&ttj|}|d jj dksFt|d jj  |d jj |d jj kstt|d jjdkst|d jjdkstt	|}t
dj| t
dj| |t dksะtd S )Nz)        a: {foo: bar, baz: quux}
        ฺaTFzx [{}]zy [{}]z:        a:
          foo: bar
          baz: quux
        )r   r   r   r   r   r   r   ฺset_block_styleฺ_flow_styler   r	   r
   )r   r   r   r   r   r   r   r   ฺ$test_deepcopy_flow_style_nested_dict   s    
 z1TestDeepCopy.test_deepcopy_flow_style_nested_dictc             C   sิ   t d}t|}|d jj dks&ttj|}|d jj dksFt|d jj  |d jj |d jj kstt|d jjdkst|d jjdkstt	|}t
dj| t
dj| |t dksะtd S )Nz        a: [1, 2, 3]
        r   TFzx [{}]zy [{}]z7        a:
        - 1
        - 2
        - 3
        )r   r   r   r   r   r   r   r   r   r   r	   r
   )r   r   r   r   r   r   r   r   ฺ$test_deepcopy_flow_style_nested_list7   s    
 z1TestDeepCopy.test_deepcopy_flow_style_nested_listN)ฺ__name__ฺ
__module__ฺ__qualname__r   r   r   r   r   r   r   r      s   r   c               @   s   e Zd Zdd Zdd ZdS )ฺTestCopyc             C   sฬ   t d}t|}|d jj dks&ttj|}|d jj dksFt|d jj  |d jj |d jj kstt|d jjdkst|d jjdkstt|}t|}||ksธt|t dksศtd S )Nz)        a: {foo: bar, baz: quux}
        r   TFz:        a:
          foo: bar
          baz: quux
        )	r   r   r   r   r   r   r   r   r   )r   r   r   r   r   ฺzr   r   r   ฺ test_copy_flow_style_nested_dictT   s    
 z)TestCopy.test_copy_flow_style_nested_dictc             C   sิ   t d}t|}|d jj dks&ttj|}|d jj dksFt|d jj  |d jj |d jj kstt|d jjdkst|d jjdkstt|}t	dj
| t	dj
| |t dksะtd S )Nz        a: [1, 2, 3]
        r   TFzx [{}]zy [{}]z7        a:
        - 1
        - 2
        - 3
        )r   r   r   r   r   r   r   r   r   r	   r
   )r   r   r   r   r   r   r   r   ฺ test_copy_flow_style_nested_listn   s    
 z)TestCopy.test_copy_flow_style_nested_listN)r   r   r   r    r!   r   r   r   r   r   S   s   r   )	ฺ__doc__r   ZpytestZ	roundtripr   r   r   r   r   r   r   r   r   ฺ<module>   s
   E