relateby-pattern 0.4.2

Core pattern data structures
Documentation
�

tzi��6�dZddlZddlmcmZd�Zd�Zd�Z	dS)z/
Tests for Subject construction and operations
�Nc��ddl}ddh}|j�d��|j�d��d�}|�d||�	��}|j}d}||k}|s�t
jd
|fd||f��dtj	��vst
j
|��rt
j|��ndt
j|��t
j|��d
�z}dd|iz}tt
j
|�����dx}x}}|���}	d}
|
|	v}|s�t
jd|fd|
|	f��t
j|
��dtj	��vst
j
|	��rt
j|	��ndd�z}dd|iz}tt
j
|�����dx}
}d}
|
|	v}|s�t
jd|fd|
|	f��t
j|
��dtj	��vst
j
|	��rt
j|	��ndd�z}dd|iz}tt
j
|�����dx}
}|���}
|
d}
d}|
|k}|slt
jd
|fd|
|f��t
j|
��t
j|��d�z}dd|iz}tt
j
|�����dx}
x}}|
d}
d}|
|k}|slt
jd
|fd|
|f��t
j|
��t
j|��d�z}dd|iz}tt
j
|�����dx}
x}}dS)z;Test creating Subject with identity, labels, and propertiesrN�Person�Employee�Alice�)�name�age�alice)�identity�labels�
properties��==)z0%(py2)s
{%(py2)s = %(py0)s.identity
} == %(py5)s�subject)�py0�py2�py5zassert %(py7)s�py7)�in)z%(py1)s in %(py3)sr)�py1�py3�assert %(py5)srr)z%(py1)s == %(py4)s)r�py4zassert %(py6)s�py6r	)�pattern_core�Value�string�int�Subjectr�
@pytest_ar�_call_reprcompare�@py_builtins�locals�_should_repr_global_name�	_saferepr�AssertionError�_format_explanation�
get_labels�get_properties)r�
labels_set�properties_dictr�@py_assert1�@py_assert4�@py_assert3�@py_format6�@py_format8r�@py_assert0�@py_assert2�@py_format4�props�@py_format5�@py_format7s                �^/Users/akollegger/Developer/gram-data/gram-rs/crates/pattern-core/tests/python/test_subject.py�test_subject_constructionr8sN�������J�'�J��"�)�)�'�2�2��!�%�%�b�)�)���O�
�"�"���"�#���G���&�w�&��w�&�&�&�&�&�&�&�&�&�&��w�&�&�&�&�&�&�&�&�&�&�&�&�7�&�&�&�&�&�7�&�&�&�&�&�&��&�&�&�&�w�&�&�&�&�&�&�&�&�&�&�&�&�&�&�&�&�&�&�&�&�&�&�&�&�&�&�&�
�
�
�
!�
!�F���8�v�����������8�v������8������������v������v������������������������������:������������:�������:�����������������������������������������������"�"�$�$�E���=�#�G�#�=�G�#�#�#�#�#�#�#�#�#�#�=�G�#�#�#�#�#�=�#�#�#�#�G�#�#�#�#�#�#�#�#�#�#�#�#�#�#�#�#�#�#�#�#�#�#�#�#�#�#�#���<��2��<�2�����������<�2������<�����2������������������������������c�|�ddl}|�d���}|�d��|j}d}||��}d}||u}|s�t	jd|fd||f��d	t
j��vst	j|��rt	j	|��nd	t	j	|��t	j	|��t	j	|��t	j	|��d
�z}dd|iz}tt	j|�����dx}x}x}x}}|�d
��|j}d
}||��}d}||u}|s�t	jd|fd||f��d	t
j��vst	j|��rt	j	|��nd	t	j	|��t	j	|��t	j	|��t	j	|��d
�z}dd|iz}tt	j|�����dx}x}x}x}}|�d��|j}d}||��}d}||u}|s�t	jd|fd||f��d	t
j��vst	j|��rt	j	|��nd	t	j	|��t	j	|��t	j	|��t	j	|��d
�z}dd|iz}tt	j|�����dx}x}x}x}}dS)zTest Subject label operationsrN�test�rrT��is)zO%(py6)s
{%(py6)s = %(py2)s
{%(py2)s = %(py0)s.has_label
}(%(py4)s)
} is %(py9)sr�rrrr�py9�assert %(py11)s�py11rF)
rr�	add_label�	has_labelr r!r"r#r$r%r&r'�remove_label)	rrr,r.�@py_assert5�@py_assert8�@py_assert7�@py_format10�@py_format12s	         r7�test_subject_labelsrK"s��������"�"�F�"�3�3�G����h������.�X�.���X�&�&�.�$�.�&�$�.�.�.�.�.�.�.�.�.�.�&�$�.�.�.�.�.�.�.�.�.�.�.�.�7�.�.�.�.�.�7�.�.�.�.�.�.��.�.�.�.�X�.�.�.�.�&�.�.�.�.�$�.�.�.�.�.�.�.�.�.�.�.�.�.�.�.�.�.�.�.�.�.�.�.�.�.�.�.�.�.�.�.����j�!�!�!���0�Z�0���Z�(�(�0�D�0�(�D�0�0�0�0�0�0�0�0�0�0�(�D�0�0�0�0�0�0�0�0�0�0�0�0�7�0�0�0�0�0�7�0�0�0�0�0�0��0�0�0�0�Z�0�0�0�0�(�0�0�0�0�D�0�0�0�0�0�0�0�0�0�0�0�0�0�0�0�0�0�0�0�0�0�0�0�0�0�0�0�0�0�0�0�����"�"�"���/�X�/���X�&�&�/�%�/�&�%�/�/�/�/�/�/�/�/�/�/�&�%�/�/�/�/�/�/�/�/�/�/�/�/�7�/�/�/�/�/�7�/�/�/�/�/�/��/�/�/�/�X�/�/�/�/�&�/�/�/�/�%�/�/�/�/�/�/�/�/�/�/�/�/�/�/�/�/�/�/�/�/�/�/�/�/�/�/�/�/�/�/�/�/�/r9c�h	�ddl}|�d���}|�d|j�d����|�d��}d}||u}|s�t
jd|fd||f��d	tj	��vst
j
|��rt
j|��nd	t
j|��d
�z}dd|iz}tt
j
|�����dx}}|j}|��}d}||k}	|	s�t
jd
|	fd||f��d	tj	��vst
j
|��rt
j|��nd	t
j|��t
j|��t
j|��d�z}
dd|
iz}tt
j
|�����dx}x}x}	}|�d|j�d����|�d��}d}||u}|s�t
jd|fd||f��dtj	��vst
j
|��rt
j|��ndt
j|��d
�z}dd|iz}tt
j
|�����dx}}|j}|��}d}||k}	|	s�t
jd
|	fd||f��dtj	��vst
j
|��rt
j|��ndt
j|��t
j|��t
j|��d�z}
dd|
iz}tt
j
|�����dx}x}x}	}|�d��|j}d}||��}	d}
|	|
u}|s�t
jd|fd|	|
f��dtj	��vst
j
|��rt
j|��ndt
j|��t
j|��t
j|	��t
j|
��d�z}dd|iz}tt
j
|�����dx}x}x}	x}}
dS)z Test Subject property operationsrNr;r<rr)�is not)z%(py0)s is not %(py3)s�	name_prop)rrrrr)zH%(py4)s
{%(py4)s = %(py2)s
{%(py2)s = %(py0)s.as_string
}()
} == %(py7)s)rrrrzassert %(py9)sr@r	r�age_prop)zE%(py4)s
{%(py4)s = %(py2)s
{%(py2)s = %(py0)s.as_int
}()
} == %(py7)sr=)zR%(py6)s
{%(py6)s = %(py2)s
{%(py2)s = %(py0)s.get_property
}(%(py4)s)
} is %(py9)srr?rArB)rr�set_propertyrr�get_propertyr r!r"r#r$r%r&r'�	as_stringr�as_int�remove_property)rrrNr2r,r3r/r.�@py_assert6rFr0rIrOrGrHrJs                r7�test_subject_propertiesrV2s\�������"�"�F�"�3�3�G������!3�!:�!:�7�!C�!C�D�D�D��$�$�V�,�,�I� � �9�D� � � � � � � � � � �9�D� � � � � � � � � � � � �9� � � � � �9� � � � � � �D� � � � � � � � � � � � � � � � � � � � � � � � � ���+��� � �+�G�+� �G�+�+�+�+�+�+�+�+�+�+� �G�+�+�+�+�+�+�+�+�+�+�+�+�9�+�+�+�+�+�9�+�+�+�+�+�+��+�+�+�+� �+�+�+�+�G�+�+�+�+�+�+�+�+�+�+�+�+�+�+�+�+�+�+�+�+�+�+�+�+�+�+�+�+�+������ 2� 6� 6�r� :� :�;�;�;��#�#�E�*�*�H���8�4�����������8�4�������������8������8�������4���������������������������?�"�?�?���"��"���"�"�"�"�"�"�"�"�"�"���"�"�"�"�"�"�"�"�"�"�"�"�8�"�"�"�"�"�8�"�"�"�"�"�"�?�"�"�"�"��"�"�"�"��"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"�"����E�"�"�"���.��.����&�&�.�$�.�&�$�.�.�.�.�.�.�.�.�.�.�&�$�.�.�.�.�.�.�.�.�.�.�.�.�7�.�.�.�.�.�7�.�.�.�.�.�.��.�.�.�.��.�.�.�.�&�.�.�.�.�$�.�.�.�.�.�.�.�.�.�.�.�.�.�.�.�.�.�.�.�.�.�.�.�.�.�.�.�.�.�.�.�.�.r9)
�__doc__�builtinsr"�_pytest.assertion.rewrite�	assertion�rewriter r8rKrV�r9r7�<module>r]sc����
����������������8
0�
0�
0� /�/�/�/�/r9