o
    
i                     @   sj   d dl Z ddlmZmZmZmZ G dd dZG dd dZG dd	 d	ZG d
d dZ	G dd dZ
dS )    N   )
round_tripdedentround_trip_loadround_trip_dumpc                   @   sH   e Zd Zejjdddd Zdd Zejjdddd Zd	d
 Z	dS )TestCommentFailuresTstrictc                 C      t d d S )N
        # the beginning
        !!set
        # or this one?
        ? a
        # next one is B (lowercase)
        ? b  #  You see? Promised you.
        ? c
        # this is the end
        r   self r   U/home/ubuntu/.local/lib/python3.10/site-packages/srsly/tests/ruamel_yaml/test_fail.pytest_set_comment_before_tag   s   z/TestCommentFailures.test_set_comment_before_tagc                 C   s    d}t t|tdksJ d S )Nr   z
        !!set
        # or this one?
        ? a
        # next one is B (lowercase)
        ? b  #  You see? Promised you.
        ? c
        # this is the end
        r   r   r   r   inpr   r   r   #test_set_comment_before_tag_no_fail   s   
z7TestCommentFailures.test_set_comment_before_tag_no_failc                 C   r
   )N9
        - # abc
           a: 1
           b: 2
        r   r   r   r   r   test_comment_dash_line7      z*TestCommentFailures.test_comment_dash_linec                 C   s$   d}t |}t|tdksJ d S )Nr   z7
          # abc
        - a: 1
          b: 2
        )r   r   r   )r   xdatar   r   r   test_comment_dash_line_failA   s
   z/TestCommentFailures.test_comment_dash_line_failN)
__name__
__module____qualname__pytestmarkxfailr   r   r   r   r   r   r   r   r      s    

	r   c                   @   s2   e Zd Zejjdddd Zdd Zdd Zd	S )
TestIndentFailuresTr   c                 C   r
   )N9  
        verbosity: 1                  # 0 is minimal output, -1 none
        base_url: http://gopher.net
        special_indices: [1, 5, 8]
        also_special:
        - a
        - 19
        - 32
        asia and europe: &asia_europe
            Turkey: Ankara
            Russia: Moscow
        countries:
            Asia:
                <<: *asia_europe
                Japan: Tokyo # 東京
            Europe:
                <<: *asia_europe
                Spain: Madrid
                Italy: Rome
            Antarctica:
            -   too cold
        r   r   r   r   r   test_indent_not_retainedS   r   z+TestIndentFailures.test_indent_not_retainedc                 C   s$   d}t t|ddtdksJ d S )Nr#      indentu?  
        verbosity: 1                  # 0 is minimal output, -1 none
        base_url: http://gopher.net
        special_indices: [1, 5, 8]
        also_special:
        -   a
        -   19
        -   32
        asia and europe: &asia_europe
            Turkey: Ankara
            Russia: Moscow
        countries:
            Asia:
                <<: *asia_europe
                Japan: Tokyo # 東京
            Europe:
                <<: *asia_europe
                Spain: Madrid
                Italy: Rome
            Antarctica:
            -   too cold
        r   r   r   r   r    test_indent_not_retained_no_failn   s   z3TestIndentFailures.test_indent_not_retained_no_failc                 C      d}t |dd d S )Nz(
        -   a:
            - b
        r%   r&   r   r   r   r   r   Xtest_indent_top_level_no_fail   s   z1TestIndentFailures.Xtest_indent_top_level_no_failN)	r   r   r   r   r    r!   r$   r(   r*   r   r   r   r   r"   R   s
    
0r"   c                   @   s*   e Zd Zejjdddd Zdd ZdS )TestTagFailuresTr   c                 C   r
   )Nz^        !!map
        name: Anthon
        location: Germany
        language: python
        r   r   r   r   r   test_standard_short_tag   r   z'TestTagFailures.test_standard_short_tagc                 C   s$   d}d}t t|t|ksJ d S )Nz_
        !!map
        name: Anthon
        location: Germany
        language: python
        zQ
        name: Anthon
        location: Germany
        language: python
        r   )r   r   expr   r   r   test_standard_short_tag_no_fail   s   z/TestTagFailures.test_standard_short_tag_no_failN)r   r   r   r   r    r!   r,   r.   r   r   r   r   r+      s    

r+   c                   @   s   e Zd Zdd Zdd ZdS )TestFlowValuesc                 C   s   d}t | d S )Nz        {a: bcd:efg}
        r   r   r   r   r   test_flow_value_with_colon   s   z)TestFlowValues.test_flow_value_with_colonc                 C   r)   )Nz        {a: 'bcd:efg'}
        Tpreserve_quotesr   r   r   r   r   !test_flow_value_with_colon_quoted   s   z0TestFlowValues.test_flow_value_with_colon_quotedN)r   r   r   r0   r3   r   r   r   r   r/      s    r/   c                   @   s,   e Zd Zdd Zdd Zdd Zdd Zd	S )
TestMappingKeyc                 C   s   d}t |ddd d S )N*        {a: 1, b: 2}: hello world
        TF)r2   	dump_datar   r   r   r   r   test_simple_mapping_key   s   z&TestMappingKey.test_simple_mapping_keyc                 C   s8   ddl m} |ddgdi}td}t||ksJ d S )Nr   CommentedKeyMapar   b   zhello worldr5   )srsly.ruamel_yaml.commentsr9   r   r   )r   r9   dr-   r   r   r   test_set_simple_mapping_key   s   z*TestMappingKey.test_set_simple_mapping_keyc                 C   sV   ddl m} d}t|dd}||ddg||dd	g< td
}t||ks)J d S )Nr   r8   r5   Tr1   r:   r<   )r=   r   )r;   r>   z*        {b: 1, a: 2}: hello world
        )r?   r9   r   popr   r   r   r9   r   r@   r-   r   r   r   "test_change_key_simple_mapping_key   s   
z1TestMappingKey.test_change_key_simple_mapping_keyc                 C   sH   ddl m} d}t|dd}|ddgdi}td	}t||ks"J d S )
Nr   r8   r5   Tr1   r:   r<   goodbyez&        {a: 1, b: 2}: goodbye
        )r?   r9   r   r   r   rC   r   r   r   $test_change_value_simple_mapping_key   s   z3TestMappingKey.test_change_value_simple_mapping_keyN)r   r   r   r7   rA   rD   rF   r   r   r   r   r4      s
    r4   )r   	roundtripr   r   r   r   r   r"   r+   r/   r4   r   r   r   r   <module>   s   DT