relateby-pattern 0.2.9

Core pattern data structures
Documentation
�

��}i���P�dZddlZddlmcmZddlZd�Zd�Z	d�Z
d�Zd�Zd�Z
dS)	z[
Tests for Pattern operations (inspection, queries, transformations, combination, comonad)
�Nc�>�tj�d��}|j}|��}d}||k}|s�t	jd|fd||f��dt
j��vst	j|��rt	j	|��ndt	j	|��t	j	|��t	j	|��d�z}dd|iz}tt	j|�����d	x}x}x}}|j}|��}d
}||k}|s�t	jd|fd||f��dt
j��vst	j|��rt	j	|��ndt	j	|��t	j	|��t	j	|��d�z}dd|iz}tt	j|�����d	x}x}x}}|j
}|��}d}||k}|s�t	jd|fd||f��dt
j��vst	j|��rt	j	|��ndt	j	|��t	j	|��t	j	|��d�z}dd|iz}tt	j|�����d	x}x}x}}|j}|��}d
}||u}|s�t	jd|fd||f��dt
j��vst	j|��rt	j	|��ndt	j	|��t	j	|��t	j	|��d�z}dd|iz}tt	j|�����d	x}x}x}}tj�d��}tj�d��}tj�d||g��}	|	j}|��}d}||k}|s�t	jd|fd||f��dt
j��vst	j|	��rt	j	|	��ndt	j	|��t	j	|��t	j	|��d�z}dd|iz}tt	j|�����d	x}x}x}}|	j}|��}d}||k}|s�t	jd|fd||f��dt
j��vst	j|	��rt	j	|	��ndt	j	|��t	j	|��t	j	|��d�z}dd|iz}tt	j|�����d	x}x}x}}|	j
}|��}d
}||k}|s�t	jd|fd||f��dt
j��vst	j|	��rt	j	|	��ndt	j	|��t	j	|��t	j	|��d�z}dd|iz}tt	j|�����d	x}x}x}}|	j}|��}d}||u}|s�t	jd|fd||f��dt
j��vst	j|	��rt	j	|	��ndt	j	|��t	j	|��t	j	|��d�z}dd|iz}tt	j|�����d	x}x}x}}tj�d��}
tj�d|
g��}tj�d|g��}|j
}|��}d}||k}|s�t	jd|fd||f��dt
j��vst	j|��rt	j	|��ndt	j	|��t	j	|��t	j	|��d�z}dd|iz}tt	j|�����d	x}x}x}}|j}|��}d}||k}|s�t	jd|fd||f��dt
j��vst	j|��rt	j	|��ndt	j	|��t	j	|��t	j	|��d�z}dd|iz}tt	j|�����d	x}x}x}}d	S)zHTest Pattern inspection methods (length, size, depth, is_atomic, values)�hellor��==�zE%(py4)s
{%(py4)s = %(py2)s
{%(py2)s = %(py0)s.length
}()
} == %(py7)s�atomic��py0�py2�py4�py7�assert %(py9)s�py9N��zC%(py4)s
{%(py4)s = %(py2)s
{%(py2)s = %(py0)s.size
}()
} == %(py7)s�zD%(py4)s
{%(py4)s = %(py2)s
{%(py2)s = %(py0)s.depth
}()
} == %(py7)sT��is)zH%(py4)s
{%(py4)s = %(py2)s
{%(py2)s = %(py0)s.is_atomic
}()
} is %(py7)s�child1�child2�parent��F�
grandchild�nested�root�deep_parent)�pattern_core�Pattern�point�length�
@pytest_ar�_call_reprcompare�@py_builtins�locals�_should_repr_global_name�	_saferepr�AssertionError�_format_explanation�size�depth�	is_atomic�pattern)
r�@py_assert1�@py_assert3�@py_assert6�@py_assert5�@py_format8�@py_format10rrrr�nested_childrs
             �a/Users/akollegger/Developer/gram-data/gram-rs/crates/pattern-core/tests/python/test_operations.py�test_pattern_inspectionr6s�
���
!�
'�
'��
0�
0�F��=��=�=�?�?��a��?�a�����������?�a�������������6������6�������=�����?�����a�������������������������������;��;�;�=�=��A��=�A�����������=�A�������������6������6�������;�����=�����A�������������������������������<��<�<�>�>��Q��>�Q�����������>�Q�������������6������6�������<�����>�����Q��������������������������������%�����%��%���%�%�%�%�%�%�%�%�%�%���%�%�%�%�%�%�%�%�%�%�%�%�6�%�%�%�%�%�6�%�%�%�%�%�%��%�%�%�%��%�%�%�%��%�%�%�%�%�%�%�%�%�%�%�%�%�%�%�%�%�%�%�%�%�%�%�%�%�%�%�%�%��
!�
'�
'��
1�
1�F�
�
!�
'�
'��
1�
1�F�
�
!�
)�
)�(�V�V�4D�
E�
E�F��=��=�=�?�?��a��?�a�����������?�a�������������6������6�������=�����?�����a�������������������������������;��;�;�=�=��A��=�A�����������=�A�������������6������6�������;�����=�����A�������������������������������<��<�<�>�>��Q��>�Q�����������>�Q�������������6������6�������<�����>�����Q��������������������������������&�����&��&���&�&�&�&�&�&�&�&�&�&���&�&�&�&�&�&�&�&�&�&�&�&�6�&�&�&�&�&�6�&�&�&�&�&�&��&�&�&�&��&�&�&�&��&�&�&�&�&�&�&�&�&�&�&�&�&�&�&�&�&�&�&�&�&�&�&�&�&�&�&�&�&��%�+�+�L�9�9�J��'�/�/��:�,�G�G�L��&�.�.�v��~�F�F�K���#�����#�!�#��!�#�#�#�#�#�#�#�#�#�#��!�#�#�#�#�#�#�#�#�#�#�#�#�;�#�#�#�#�#�;�#�#�#�#�#�#��#�#�#�#��#�#�#�#�!�#�#�#�#�#�#�#�#�#�#�#�#�#�#�#�#�#�#�#�#�#�#�#�#�#�#�#�#�#���"�����"��"���"�"�"�"�"�"�"�"�"�"���"�"�"�"�"�"�"�"�"�"�"�"�;�"�"�"�"�"�;�"�"�"�"�"�"��"�"�"�"��"�"�"�"��"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�c��tj�dtj�d��tj�d��tj�d��g��}|j}d�}||��}d}||u}|s�tjd|fd||f��d	tj��vstj	|��rtj
|��nd	tj
|��tj
|��tj
|��tj
|��d
�z}dd|iz}ttj|�����d
x}x}x}x}}|j}d�}||��}d}||u}|s�tjd|fd||f��d	tj��vstj	|��rtj
|��nd	tj
|��tj
|��tj
|��tj
|��d
�z}dd|iz}ttj|�����d
x}x}x}x}}|j
}d�}||��}d}||u}|s�tjd|fd||f��d	tj��vstj	|��rtj
|��nd	tj
|��tj
|��tj
|��tj
|��d
�z}dd|iz}ttj|�����d
x}x}x}x}}|�d���}t|��}	d}|	|k}
|
s�tjd|
fd|	|f��dtj��vstj	t��rtj
t��nddtj��vstj	|��rtj
|��ndtj
|	��tj
|��d�z}dd|iz}ttj|�����d
x}	x}
}|�d���}
d
}	|
|	u}|s�tjd|fd|
|	f��dtj��vstj	|
��rtj
|
��ndtj
|	��d�z}d d!|iz}ttj|�����d
x}}	|
j}d}
||
k}|s�tjd|fd"||
f��dtj��vstj	|
��rtj
|
��ndtj
|��tj
|
��d#�z}d$d%|iz}ttj|�����d
x}x}}
tj�dtj�d��tj�d��tj�d��g��}|j}||��}
d}|
|u}|s�tjd|fd&|
|f��d	tj��vstj	|��rtj
|��nd	tj
|��d'tj��vstj	|��rtj
|��nd'tj
|
��tj
|��d(�z}d)d*|iz}ttj|�����d
x}x}
x}}tj�d��}|j}||��}
d}|
|u}|s�tjd|fd+|
|f��d	tj��vstj	|��rtj
|��nd	tj
|��d,tj��vstj	|��rtj
|��nd,tj
|
��tj
|��d(�z}d)d*|iz}ttj|�����d
x}x}
x}}d
S)-zYTest Pattern query methods (any_value, all_values, filter, find_first, matches, contains)rr�world�pythonc�
�d|vS)N�o���vs r5�<lambda>z&test_pattern_queries.<locals>.<lambda>-�
��s�a�x�r7Tr�zO%(py6)s
{%(py6)s = %(py2)s
{%(py2)s = %(py0)s.any_value
}(%(py4)s)
} is %(py9)sr-�r
rr�py6r�assert %(py11)s�py11Nc�
�d|vS)N�zr=r>s r5r@z&test_pattern_queries.<locals>.<lambda>.rAr7Fc�,�t|t��S�N)�
isinstance�strr>s r5r@z&test_pattern_queries.<locals>.<lambda>1s��
�1�c�(:�(:�r7�zP%(py6)s
{%(py6)s = %(py2)s
{%(py2)s = %(py0)s.all_values
}(%(py4)s)
} is %(py9)sc�2�t|j��dkS)N�)�len�value��ps r5r@z&test_pattern_queries.<locals>.<lambda>4s���A�G���q�(8�r7rr)z0%(py3)s
{%(py3)s = %(py0)s(%(py1)s)
} == %(py6)srP�filtered)r
�py1�py3rD�assert %(py8)s�py8c�6�|j�d��S)N�w)rQ�
startswithrRs r5r@z&test_pattern_queries.<locals>.<lambda>8s����);�);�C�)@�)@�r7)�is not)z%(py0)s is not %(py3)s�found)r
rV�assert %(py5)s�py5�z-%(py2)s
{%(py2)s = %(py0)s.value
} == %(py5)s�r
rr_�assert %(py7)sr
)zM%(py5)s
{%(py5)s = %(py2)s
{%(py2)s = %(py0)s.matches
}(%(py3)s)
} is %(py8)s�pattern2)r
rrVr_rX�assert %(py10)s�py10)zN%(py5)s
{%(py5)s = %(py2)s
{%(py2)s = %(py0)s.contains
}(%(py3)s)
} is %(py8)s�
subpattern)rrr-r �	any_valuer"r#r$r%r&r'r(r)�
all_values�filterrP�
find_firstrQ�matches�contains)r-r.r/r1�@py_assert8�@py_assert7r3�@py_format12rT�@py_assert2�@py_assert4�@py_format7�@py_format9r]�@py_format4�@py_format6r2rcr0�@py_format11rfs                     r5�test_pattern_queriesrw#s�	���"�*�*�6���"�"�7�+�+���"�"�7�+�+���"�"�8�,�,�4���G���8�/�/�8���/�0�0�8�D�8�0�D�8�8�8�8�8�8�8�8�8�8�0�D�8�8�8�8�8�8�8�8�8�8�8�8�7�8�8�8�8�8�7�8�8�8�8�8�8��8�8�8�8�/�8�8�8�8�0�8�8�8�8�D�8�8�8�8�8�8�8�8�8�8�8�8�8�8�8�8�8�8�8�8�8�8�8�8�8�8�8�8�8�8�8���9�/�/�9���/�0�0�9�E�9�0�E�9�9�9�9�9�9�9�9�9�9�0�E�9�9�9�9�9�9�9�9�9�9�9�9�7�9�9�9�9�9�7�9�9�9�9�9�9��9�9�9�9�/�9�9�9�9�0�9�9�9�9�E�9�9�9�9�9�9�9�9�9�9�9�9�9�9�9�9�9�9�9�9�9�9�9�9�9�9�9�9�9�9�9���C�:�:�C���:�;�;�C�t�C�;�t�C�C�C�C�C�C�C�C�C�C�;�t�C�C�C�C�C�C�C�C�C�C�C�C�7�C�C�C�C�C�7�C�C�C�C�C�C��C�C�C�C�:�C�C�C�C�;�C�C�C�C�t�C�C�C�C�C�C�C�C�C�C�C�C�C�C�C�C�C�C�C�C�C�C�C�C�C�C�C�C�C�C�C��~�~�8�8�9�9�H��x�=�=��A��=�A�����������=�A�������������3������3��������������x������x�������=�����A����������������������������
���@�@�A�A�E���5������������5��������������5������5����������������������������������;�!�'�!�;�'�!�!�!�!�!�!�!�!�!�!�;�'�!�!�!�!�!�!�!�!�!�!�!�!�5�!�!�!�!�!�5�!�!�!�!�!�!�;�!�!�!�!�'�!�!�!�!�!�!�!�!�!�!�!�!�!�!�!�!�!�!�!�!�!�!�!�!�!�!�!��#�+�+�F���"�"�7�+�+���"�"�7�+�+���"�"�8�,�,�5���H�
�?�,�?�?�8�$�$�,��,�$��,�,�,�,�,�,�,�,�,�,�$��,�,�,�,�,�,�,�,�,�,�,�,�7�,�,�,�,�,�7�,�,�,�,�,�,�?�,�,�,�,�,�,�,�,�,�,�,�8�,�,�,�,�,�8�,�,�,�,�,�,�$�,�,�,�,��,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,��%�+�+�G�4�4�J���/���J�'�'�/�4�/�'�4�/�/�/�/�/�/�/�/�/�/�'�4�/�/�/�/�/�/�/�/�/�/�/�/�7�/�/�/�/�/�7�/�/�/�/�/�/��/�/�/�/�/�/�/�/�/�/�/�J�/�/�/�/�/�J�/�/�/�/�/�/�'�/�/�/�/�4�/�/�/�/�/�/�/�/�/�/�/�/�/�/�/�/�/�/�/�/�/�/�/�/�/�/�/�/�/�/�/r7c��tj�dtj�d��tj�d��g��}|�t
j��}|j}d}||k}|s�tj	d|fd||f��dtj��vstj|��rtj
|��ndtj
|��tj
|��d�z}d	d
|iz}ttj|�����dx}x}}|jd}|j}d
}	||	k}|stj	d|fd||	f��tj
|��tj
|��tj
|	��d�z}
dd|
iz}ttj|�����dx}x}x}}	|jd}|j}d}	||	k}|stj	d|fd||	f��tj
|��tj
|��tj
|	��d�z}
dd|
iz}ttj|�����dx}x}x}}	|�dd���}d}||v}|s�tj	d|fd||f��tj
|��dtj��vstj|��rtj
|��ndd�z}
dd|
iz}ttj|�����dx}}dS)z/Test Pattern transformation methods (map, fold)rr9r:�HELLOrr`�upperrarbr
Nr�WORLD�z-%(py3)s
{%(py3)s = %(py1)s.value
} == %(py6)s�rUrVrDrWrXr�PYTHON�c��||zdzS)N� r=)�accr?s  r5r@z.test_pattern_transformations.<locals>.<lambda>Xs��S�1�W�s�]�r7zhello world python )�in)z%(py1)s in %(py3)s�result)rUrVr^r_)rrr-r �maprLrzrQr"r#r$r%r&r'r(r)�elements�fold)r-rzr.rqr/rur2�@py_assert0rpr1rrrsr�rts              r5�test_pattern_transformationsr�Is����"�*�*�7���"�"�7�+�+���"�"�8�,�,�5���G�
�K�K��	�"�"�E��;�!�'�!�;�'�!�!�!�!�!�!�!�!�!�!�;�'�!�!�!�!�!�!�!�!�!�!�!�!�5�!�!�!�!�!�5�!�!�!�!�!�!�;�!�!�!�!�'�!�!�!�!�!�!�!�!�!�!�!�!�!�!�!�!�!�!�!�!�!�!�!�!�!�!�!��>�!��-��"�-�g�-�"�g�-�-�-�-�-�-�-�-�-�-�"�g�-�-�-�-�-��-�-�-�-�"�-�-�-�-�g�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-��>�!��.��"�.�h�.�"�h�.�.�.�.�.�.�.�.�.�.�"�h�.�.�.�.�.��.�.�.�.�"�.�.�.�.�h�.�.�.�.�.�.�.�.�.�.�.�.�.�.�.�.�.�.�.�.�.�.�.�.�.�.�.�.�.��\�\�"�:�:�
;�
;�F� �*� �F�*�*�*�*�*�*�*�*�*�*� �F�*�*�*�*�*� �*�*�*�*�*�*�*�*�*�*�*�F�*�*�*�*�*�F�*�*�*�*�*�*�*�*�*�*�*�*�*�*�*�*�*�*�*�*�*�*�*�*�*�*�*�*�*r7c�j�tj�d��}tj�d��}|�|��}|j}d}||k}|s�tjd|fd||f��dtj��vstj	|��rtj
|��ndtj
|��tj
|��d�z}dd	|iz}ttj|�����d
x}x}}tj�
dtj�d��tj�d
��g��}tj�
dtj�d��g��}	|�|	��}
|
j}d}||k}|s�tjd|fd||f��dtj��vstj	|
��rtj
|
��ndtj
|��tj
|��d�z}dd	|iz}ttj|�����d
x}x}}|
j}t|��}d}||k}
|
�stjd|
fd||f��dtj��vstj	t��rtj
t��nddtj��vstj	|
��rtj
|
��ndtj
|��tj
|��tj
|��d�z}dd|iz}ttj|�����d
x}x}x}
}d
S)zTest Pattern combination methodrz worldzhello worldrr`�combinedrarbr
N�a�b�c�d�e�adr�r)zN%(py5)s
{%(py5)s = %(py0)s(%(py3)s
{%(py3)s = %(py1)s.elements
})
} == %(py8)srP)r
rUrVr_rXrdre)rrr �combinerQr"r#r$r%r&r'r(r)r-r�rP)�p1�p2r�r.rqr/rur2�p3�p4r�rprnr0rsrvs                r5�test_pattern_combinationr�\s���
�	�	#�	#�G�	,�	,�B�	�	�	#�	#�H�	-�	-�B��z�z�"�~�~�H��>�*�]�*�>�]�*�*�*�*�*�*�*�*�*�*�>�]�*�*�*�*�*�*�*�*�*�*�*�*�8�*�*�*�*�*�8�*�*�*�*�*�*�>�*�*�*�*�]�*�*�*�*�*�*�*�*�*�*�*�*�*�*�*�*�*�*�*�*�*�*�*�*�*�*�*�
�	�	%�	%�c���"�"�3�'�'���"�"�3�'�'�,�
�
�B�
�	�	%�	%�c���"�"�3�'�'�,�
�
�B��Z�Z��^�^�F��<��4��<�4�����������<�4�������������6������6�������<�����4������������������������������$�3����$�1�$��1�$�$�$�$�$�$�$�$�$�$��1�$�$�$�$�$�$�$�$�$�$�$�$�3�$�$�$�$�$�3�$�$�$�$�$�$�$�$�$�$�$�$�$�v�$�$�$�$�$�v�$�$�$�$�$�$��$�$�$�$��$�$�$�$�1�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$r7c	�r�tj�dtj�dtj�d��g��tj�d��g��}|j}|��}d}||k}|s�tjd|fd||f��dtj��vstj	|��rtj
|��ndtj
|��tj
|��tj
|��d�z}d	d
|iz}ttj|�����dx}x}x}}|�
d���}|j}d
}||k}|s�tjd|fd||f��dtj��vstj	|��rtj
|��ndtj
|��tj
|��d�z}	dd|	iz}ttj|�����dx}x}}|jd}
|
j}d}||k}|stjd|fd||f��tj
|
��tj
|��tj
|��d�z}dd|iz}
ttj|
�����dx}
x}x}}|jd}
|
j}d}||k}|stjd|fd||f��tj
|
��tj
|��tj
|��d�z}dd|iz}
ttj|
�����dx}
x}x}}|���}|j}d
}||k}|s�tjd|fd||f��dtj��vstj	|��rtj
|��ndtj
|��tj
|��d�z}	dd|	iz}ttj|�����dx}x}}|jd}
|
j}d}||k}|stjd|fd||f��tj
|
��tj
|��tj
|��d�z}dd|iz}
ttj|
�����dx}
x}x}}|���}|j}d}||k}|s�tjd|fd||f��dtj��vstj	|��rtj
|��ndtj
|��tj
|��d�z}	dd|	iz}ttj|�����dx}x}}|jd}
|
j}d
}||k}|stjd|fd||f��tj
|
��tj
|��tj
|��d�z}dd|iz}
ttj|
�����dx}
x}x}}|jd}
|
j}d}||k}|stjd|fd||f��tj
|
��tj
|��tj
|��d�z}dd|iz}
ttj|
�����dx}
x}x}}|���}|j}g}||k}|s�tjd|fd||f��dtj��vstj	|��rtj
|��ndtj
|��tj
|��d�z}	dd|	iz}ttj|�����dx}x}}|jd}
|
j}dg}||k}|stjd|fd||f��tj
|
��tj
|��tj
|��d�z}dd|iz}
ttj|
�����dx}
x}x}}|jd}
|
j}dg}||k}|stjd|fd||f��tj
|
��tj
|��tj
|��d�z}dd|iz}
ttj|
�����dx}
x}x}}dS)zPTest Pattern comonad operations (extract, extend, depth_at, size_at, indices_at)rr��xr�r)zF%(py4)s
{%(py4)s = %(py2)s
{%(py2)s = %(py0)s.extract
}()
} == %(py7)sr-r	rrNc�*�|���SrJ)r+rRs r5r@z&test_pattern_comonad.<locals>.<lambda>�s��a�g�g�i�i�r7rr`�depthsrarbr
rrr|r}rWrX�depths2rO�sizes�indices)rrr-r �extractr"r#r$r%r&r'r(r)�extendrQr��depth_at�size_at�
indices_at)r-r.r/r0r1r2r3r�rqrur�rprrrsr�r�r�s                 r5�test_pattern_comonadr�ss�
���"�*�*�6���$�$�S�� �&�&�s�+�+�+
�	�	�	��"�"�3�'�'�	4���G��?�&�?�?���&��&���&�&�&�&�&�&�&�&�&�&���&�&�&�&�&�&�&�&�&�&�&�&�7�&�&�&�&�&�7�&�&�&�&�&�&�?�&�&�&�&��&�&�&�&��&�&�&�&�&�&�&�&�&�&�&�&�&�&�&�&�&�&�&�&�&�&�&�&�&�&�&�&�&��^�^�/�/�
0�
0�F��<��1��<�1�����������<�1�������������6������6�������<�����1�����������������������������?�1��(��#�(�q�(�#�q�(�(�(�(�(�(�(�(�(�(�#�q�(�(�(�(�(��(�(�(�(�#�(�(�(�(�q�(�(�(�(�(�(�(�(�(�(�(�(�(�(�(�(�(�(�(�(�(�(�(�(�(�(�(�(�(��?�1��(��#�(�q�(�#�q�(�(�(�(�(�(�(�(�(�(�#�q�(�(�(�(�(��(�(�(�(�#�(�(�(�(�q�(�(�(�(�(�(�(�(�(�(�(�(�(�(�(�(�(�(�(�(�(�(�(�(�(�(�(�(�(���� � �G��=��A��=�A�����������=�A�������������7������7�������=�����A������������������������������A��)��$�)��)�$��)�)�)�)�)�)�)�)�)�)�$��)�)�)�)�)��)�)�)�)�$�)�)�)�)��)�)�)�)�)�)�)�)�)�)�)�)�)�)�)�)�)�)�)�)�)�)�)�)�)�)�)�)�)�
�O�O���E��;��!��;�!�����������;�!�������������5������5�������;�����!�����������������������������>�!��'��"�'�a�'�"�a�'�'�'�'�'�'�'�'�'�'�"�a�'�'�'�'�'��'�'�'�'�"�'�'�'�'�a�'�'�'�'�'�'�'�'�'�'�'�'�'�'�'�'�'�'�'�'�'�'�'�'�'�'�'�'�'��>�!��'��"�'�a�'�"�a�'�'�'�'�'�'�'�'�'�'�"�a�'�'�'�'�'��'�'�'�'�"�'�'�'�'�a�'�'�'�'�'�'�'�'�'�'�'�'�'�'�'�'�'�'�'�'�'�'�'�'�'�'�'�'�'�� � �"�"�G��=��B��=�B�����������=�B�������������7������7�������=�����B������������������������������A��+��$�+���+�$��+�+�+�+�+�+�+�+�+�+�$��+�+�+�+�+��+�+�+�+�$�+�+�+�+��+�+�+�+�+�+�+�+�+�+�+�+�+�+�+�+�+�+�+�+�+�+�+�+�+�+�+�+�+���A��+��$�+���+�$��+�+�+�+�+�+�+�+�+�+�$��+�+�+�+�+��+�+�+�+�$�+�+�+�+��+�+�+�+�+�+�+�+�+�+�+�+�+�+�+�+�+�+�+�+�+�+�+�+�+�+�+�+�+�+�+r7c	���tjddhdtj�d��i���}tjddhdtj�d��i���}tj�|tj�|��g��}|j}|��}d}||k}|s�tj	d	|fd
||f��dtj��vstj|��rtj
|��ndtj
|��tj
|��tj
|��d�z}d
d|iz}ttj|�����dx}x}x}}|j}|��}d}||k}|s�tj	d	|fd||f��dtj��vstj|��rtj
|��ndtj
|��tj
|��tj
|��d�z}d
d|iz}ttj|�����dx}x}x}}|j}|��}d}||k}|s�tj	d	|fd||f��dtj��vstj|��rtj
|��ndtj
|��tj
|��tj
|��d�z}d
d|iz}ttj|�����dx}x}x}}|j}d�}||��}d}	||	u}
|
s�tj	d|
fd||	f��dtj��vstj|��rtj
|��ndtj
|��tj
|��tj
|��tj
|	��d�z}dd|iz}ttj|�����dx}x}x}x}
}	|j}d�}||��}d}	||	u}
|
s�tj	d|
fd||	f��dtj��vstj|��rtj
|��ndtj
|��tj
|��tj
|��tj
|	��d�z}dd|iz}ttj|�����dx}x}x}x}
}	d�}|�|��}
|
j}|j}d}||��}
d}|
|u}|s�tj	d|fd|
|f��dtj��vstj|
��rtj
|
��ndtj
|��tj
|��tj
|��tj
|
��tj
|��d �z}d!d"|iz}ttj|�����dx}x}x}x}
x}}dS)#z Test Pattern[Subject] operations�alice�Person�name�Alice)�identity�labels�
properties�bob�Bobrrrr-r	rrNrrrc��|jdkS)Nr�)r���ss r5r@z1test_pattern_subject_operations.<locals>.<lambda>�s
��q�z�U�':�r7TrrBrCrErFc�.�d|���vS)Nr�)�
get_labelsr�s r5r@z1test_pattern_subject_operations.<locals>.<lambda>�s���A�L�L�N�N�(B�r7rMc�0�|�d��|S)N�Employee)�	add_labelr�s r5r�z2test_pattern_subject_operations.<locals>.add_label�s��	���J�����r7r�)zk%(py8)s
{%(py8)s = %(py4)s
{%(py4)s = %(py2)s
{%(py2)s = %(py0)s.value
}.has_label
}(%(py6)s)
} is %(py11)s�mapped)r
rrrDrXrFzassert %(py13)s�py13)r�Subject�Value�stringrr-r r!r"r#r$r%r&r'r(r)r*r+rgrhr�rQ�	has_label)�subject1�subject2r-r.r/r0r1r2r3rmrnror�r��@py_assert10�@py_assert9�@py_format14s                 r5�test_pattern_subject_operationsr��sV���#���z��L�.�5�5�g�>�>�?����H�
�#���z��L�.�5�5�e�<�<�=����H��"�*�*��	�	�	#�	#�H�	-�	-�.���G��>� �>�>��� �q� ��q� � � � � � � � � � ��q� � � � � � � � � � � � �7� � � � � �7� � � � � � �>� � � � �� � � � �q� � � � � � � � � � � � � � � � � � � � � � � � � � � � � ��<��<�<�>�>��Q��>�Q�����������>�Q�������������7������7�������<�����>�����Q�������������������������������=��=�=�?�?��a��?�a�����������?�a�������������7������7�������=�����?�����a��������������������������������C�:�:�C���:�;�;�C�t�C�;�t�C�C�C�C�C�C�C�C�C�C�;�t�C�C�C�C�C�C�C�C�C�C�C�C�7�C�C�C�C�C�7�C�C�C�C�C�C��C�C�C�C�:�C�C�C�C�;�C�C�C�C�t�C�C�C�C�C�C�C�C�C�C�C�C�C�C�C�C�C�C�C�C�C�C�C�C�C�C�C�C�C�C�C���K�B�B�K���B�C�C�K�t�K�C�t�K�K�K�K�K�K�K�K�K�K�C�t�K�K�K�K�K�K�K�K�K�K�K�K�7�K�K�K�K�K�7�K�K�K�K�K�K��K�K�K�K�B�K�K�K�K�C�K�K�K�K�t�K�K�K�K�K�K�K�K�K�K�K�K�K�K�K�K�K�K�K�K�K�K�K�K�K�K�K�K�K�K�K�����[�[��
#�
#�F��<�5�<�!�5�*�5�!�!�*�-�-�5��5�-��5�5�5�5�5�5�5�5�5�5�-��5�5�5�5�5�5�5�5�5�5�5�5�6�5�5�5�5�5�6�5�5�5�5�5�5�<�5�5�5�5�!�5�5�5�5�*�5�5�5�5�-�5�5�5�5��5�5�5�5�5�5�5�5�5�5�5�5�5�5�5�5�5�5�5�5�5�5�5�5�5�5�5�5�5�5�5�5�5�5�5r7)�__doc__�builtinsr$�_pytest.assertion.rewrite�	assertion�rewriter"rr6rwr�r�r�r�r=r7r5�<module>r�s����������������������#�#�#�8#0�#0�#0�L+�+�+�&%�%�%�.",�",�",�J"6�"6�"6�"6�"6r7