Hacked By AnonymousFox

Current Path : /opt/cloudlinux/venv/lib/python3.11/site-packages/sqlalchemy/testing/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib/python3.11/site-packages/sqlalchemy/testing/__pycache__/assertsql.cpython-311.pyc

�

�܋f5�	��ddlZddlZddlZddlmZddlmZddlmZddlm	Z	ddl
mZddlm
Z
Gd	�d
e��ZGd�de��ZGd
�de��ZGd�de��ZGd�de��ZGd�de��ZGd�de��ZGd�de��ZGd�de��ZGd�de��ZGd�de��ZGd�d ejd gd!�����ZGd"�d#e��Zejd$���ZdS)%�N�)�event)�util)�url)�DefaultDialect)�_distill_params)�_DDLCompilesc�&�eZdZdZdZdZd�Zd�ZdS)�
AssertRuleFNTc��dS�N���self�execute_observeds  �o/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib64/python3.11/site-packages/sqlalchemy/testing/assertsql.py�process_statementzAssertRule.process_statements����c��Jd���)NFz?All statements are complete, but pending assertion rules remainr�rs r�no_more_statementszAssertRule.no_more_statementss��	
�
%�	
�	
�ur)�__name__�
__module__�__qualname__�is_consumed�errormessage�consume_statementrrrrrrrsB�������K��L���
�
�
�
�
�
�
�
rrc��eZdZdS)�SQLMatchRuleN�rrrrrrrr$s�������Drrc� �eZdZdZdd�Zd�ZdS)�	CursorSQLFNc�"�||_||_dSr
)�	statement�params)rr$r%s   r�__init__zCursorSQL.__init__+s��"�������rc�"�|jd}|j|jks|j�9|j|jkr)d|j�d|j�d|j�d|j��|_dS|j�d��d|_|js	d|_dSdS)NrzTesting for exact SQL z parameters z
 received � T)�
statementsr$r%�
parametersr�poprr)rr�stmts   rrzCursorSQL.process_statement/s����*�1�-���>�T�^�+�+��K�#���t��(F�(F��
�N�N�N��K�K�K��N�N�N��O�O��
����
�'�+�+�A�.�.�.�#�D��#�.�
.�)-��&�&�&�
.�
.rr
)rrrrr&rrrrr"r"(s=������������.�.�.�.�.rr"c�:�eZdZd
d�Zd�Zd�Zd�Zd�Zd�Zd	�Z	dS)�CompiledSQLN�defaultc�0�||_||_||_dSr
)r$r%�dialect)rr$r%r1s    rr&zCompiledSQL.__init__Es��"����������rc�D�tjdd|j��}||kS�N�[\n\t]�)�re�subr$)rr�received_statementr,s    r�_compare_sqlzCompiledSQL._compare_sqlJs"���v�i��T�^�4�4��!�T�)�)rc��|jdkrt��S|jdkrddi}ni}tj|j�����di|��S)Nr/�
postgresql�implicit_returningTr)r1rr�URL�get_dialect)rrr%s   r�_compile_dialectzCompiledSQL._compile_dialectNsi���<�9�$�$�!�#�#�#��|�|�+�+�.��5�����6�3�7�4�<�(�(�4�4�6�6�@�@��@�@�@rc�>��|j}|�|��}t|jjt
��r:|jj�||j�d������nO|jj�||jj	|jj
|j�d������tjddtj�����}|j}|s����g}n�fd�|D��}||fS)zxreconstruct the statement and params in terms
        of a target dialect, which for CompiledSQL is just DefaultDialect.�schema_translate_map)r1rA)r1�column_keys�inlinerAr4r5c�:��g|]}��|����Sr)�construct_params)�.0�m�compileds  �r�
<listcomp>z3CompiledSQL._received_statement.<locals>.<listcomp>us4���$�$�$�12��)�)�!�,�,�$�$�$r)�contextr?�
isinstancerHr$r	�compile�execution_options�getrBrCr6r7r�	text_typer*rE)rrrJ�compare_dialect�_received_statementr*�_received_parametersrHs       @rrQzCompiledSQL._received_statementYsF���#�*���/�/�0@�A�A���g�&�0�,�?�?�	��'�1�9�9�'�%,�%>�%B�%B�*�&�&�:���H�H��'�1�9�9�'�#�,�8��'�.�%,�%>�%B�%B�*�&�&�	:���H�!�f�Y��D�N�8�4L�4L�M�M��%�0�
��	�$,�$=�$=�$?�$?�#@� � �$�$�$�$�6@�$�$�$� �#�$8�8�8rc�0�|j}|�|��\}}|�|��}|�||��}|r�|��t	|��}t	|��}|ro|rmt|�d����}	tt	|����D]'\}
}|	D]}||vs|||	|krn�||
=n�(d}n|r|�m|s|rd}|rd|_d|_	dS|�
|��||d�z|_	dS)NrFT)r8�received_parameters)rJrQ�_all_paramsr9�list�dictr+�	enumeraterr�_failure_message)
rrrJrQrRr%�
equivalent�
all_params�all_received�param�idx�received�	param_keys
             rrzCompiledSQL.process_statement{s���"�*��48�4L�4L��5
�5
�1��1��!�!�'�*�*���&�&�'7�9L�M�M�
��	'��!�!�&�\�\�
�#�$8�9�9�� ��\�� �����!2�!2�3�3�E�)2�4��3E�3E�)F�)F���
��X�).�"�"�I�!*�� 9� 9�#+�I�#6�%�	�:J�#J�#J� %��$K�!-�S� 1�!�E�!&�&+�
��-!��\��.�'��'�!&�J��	�#�D�� $�D���� $� 5� 5�f� =� =�&9�';�A�A�!�D���rc��|jrPtj|j��r|�|��}n|j}t|t��s|g}|SdSr
)r%r�callablerKrV)rrJr%s   rrUzCompiledSQL._all_params�s]���;�		��}�T�[�)�)�
%����W�-�-�������f�d�+�+�
"� ����M��4rc��d|j�dd���dt|���dd���d�S)NzTesting for compiled statement �%�%%� partial params �E, received %(received_statement)r with params %(received_parameters)r)r$�replace�repr�r�expected_paramss  rrYzCompiledSQL._failure_message�sL�����&�&�s�D�1�1�1�1��_�%�%�-�-�c�4�8�8�8�8�
�	
r�Nr/)
rrrr&r9r?rQrrUrYrrrr.r.Ds�����������
*�*�*�	A�	A�	A� 9� 9� 9�D/�/�/�b
�
�
�	
�	
�	
�	
�	
rr.c�"�eZdZdd�Zd�Zd�ZdS)�RegexSQLNr/c��t�|��tj|��|_||_||_||_dSr
)rr&r6rL�regex�
orig_regexr%r1)rrpr%r1s    rr&zRegexSQL.__init__�s@�����d�#�#�#��Z��&�&��
�����������rc��d|j�dd���dt|���dd���d�S)Nz Testing for compiled statement ~rdrerfrg)rqrhrirjs  rrYzRegexSQL._failure_message�sL�����'�'��T�2�2�2�2��_�%�%�-�-�c�4�8�8�8�8�
�	
rc�P�t|j�|����Sr
)�boolrp�match)rrr8s   rr9zRegexSQL._compare_sql�s!���D�J�$�$�%7�8�8�9�9�9rrl)rrrr&rYr9rrrrnrn�sF����������	
�	
�	
�:�:�:�:�:rrnc�0��eZdZd�Zd�Z�fd�Zd�Z�xZS)�
DialectSQLc��|jjSr
)rJr1rs  rr?zDialectSQL._compile_dialect�s���'�/�/rc�:�tjdd|��}||kSr3)r6r7)r�	real_stmt�
received_stmtr,s    r�_compare_no_spacezDialectSQL._compare_no_space�s ���v�i��Y�/�/����$�$rc����tt|���|��\}}|jD]}|�|j|��rn� t
d|z���||jjfS)NzICan't locate compiled statement %r in list of statements actually invoked)	�superrwrQr)r|r$�AssertionErrorrJ�compiled_parameters)rrr{�received_paramsrz�	__class__s     �rrQzDialectSQL._received_statement�s����).���*
�*
�
�
�.�
/�
/�	'�
��
*�4�	�	�I��%�%�i�&9�=�I�I�
���
�!�.�0=�>���
�
�.�6�J�J�Jrc��tjdd|j��}|jjj}|dkrtjdd|��}n2d}|dkrd}n|dkrd	}n|d
krd}tjd||��}||kS)Nr4r5�pyformatz	:([\w_]+)z%(\1)s�qmark�?�formatz%s�numeric)r6r7r$rJr1�
paramstyle)rrr8r,r��repls      rr9zDialectSQL._compare_sql�s����v�i��T�^�4�4��&�-�5�@�
���#�#��6�,�	�4�8�8�D�D��D��W�$�$�����x�'�'�����y�(�(����6�,��d�3�3�D�!�T�)�)r)rrrr?r|rQr9�
__classcell__�r�s@rrwrw�sj�������0�0�0�%�%�%�K�K�K�K�K�"*�*�*�*�*�*�*rrwc� �eZdZd�Zd�Zd�ZdS)�CountStatementsc�"�||_d|_dS�Nr��count�_statement_count)rr�s  rr&zCountStatements.__init__
s����
� !����rc�&�|xjdz
c_dS)N�)r�rs  rrz!CountStatements.process_statements������"����rc�X�|j|jkrJd|j|jfz���dS)NFz,desired statement count %d does not match %dr�rs rrz"CountStatements.no_more_statementssD���:��.�.�.�
�H��
��%�L��
�
�5�/�.rN)rrrr&rrrrrr�r�	sA������"�"�"�#�#�#�����rr�c��eZdZd�Zd�ZdS)�AllOfc�.�t|��|_dSr
)�set�rules�rr�s  rr&zAllOf.__init__s����Z�Z��
�
�
rc�:�t|j��D]a}d|_|�|��|jr+|j�|��|jsd|_dS|js
d|_dS�bt|j��dj|_dS�NTr)rVr�rrr�discard�rr�rules   rrzAllOf.process_statements������$�$�
	A�
	A�D� $�D���"�"�#3�4�4�4���
��
�"�"�4�(�(�(��z�,�'+�D�$�����&�
�$(��!����
�
!%�T�Z� 0� 0�� 3� @�D���rN)rrrr&rrrrr�r�s7������ � � �A�A�A�A�Arr�c�*��eZdZd�Zd�Z�fd�Z�xZS)�EachOfc�.�t|��|_dSr
)rVr�r�s  rr&zEachOf.__init__/s���%�[�[��
�
�
rc��|jrf|jd}|�|��|jr|j�d��n|jr|j|_|jrn|j�f|js	d|_dSdS)NrT)r�rrr+rrr�s   rrzEachOf.process_statement2s����j�	��:�a�=�D��"�"�#3�4�4�4���
6��
���q�!�!�!�!��"�
6�$(�$5��!��%�
���j�	��z�	$�#�D����	$�	$rc����|jr3|jdjs!|jd���dS|jr)tt|�����dSdSr�)r�rrr~r�)rr�s �rrzEachOf.no_more_statements@sq����:�	5�d�j��m�7�	5��J�q�M�,�,�.�.�.�.�.�
�Z�	5��&�$���2�2�4�4�4�4�4�	5�	5r)rrrr&rrr�r�s@rr�r�.sV�������!�!�!�$�$�$�5�5�5�5�5�5�5�5�5rr�c��eZdZd�ZdS)�Orc��|jD](}|�|��|jr
d|_dS�)t|j��dj|_dSr�)r�rrrVrr�s   rrzOr.process_statementHsk���J�	A�	A�D��"�"�#3�4�4�4���
�#'�� ����
�!%�T�Z� 0� 0�� 3� @�D���rN)rrrrrrrr�r�Gs(������A�A�A�A�Arr�c��eZdZd�ZdS)�SQLExecuteObservedc�Z�||_||_t||��|_g|_dSr
)rJ�
clauseelementrr*r))rrJr��multiparamsr%s     rr&zSQLExecuteObserved.__init__Ss-�����*���)�+�v�>�>�������rN)rrrr&rrrr�r�Rs#����������rr�c��eZdZdS)�SQLCursorExecuteObservedNr rrrr�r�Zs������	�Drr�)r$r*rJ�executemanyc� �eZdZd�Zd�Zd�ZdS)�SQLAsserterc��g|_dSr
)�accumulatedrs rr&zSQLAsserter.__init__ds������rc�"�|j|_|`dSr
)r��_finalrs r�_closezSQLAsserter._closegs���&������rc�*�t|�}t|j��}|rJ|�d��}|�|��|jrn|jrJ|j���|�J|r
Jd���|js|���dSdS)NrFz Additional SQL statements remain)r�rVr�r+rrrr)rr�r��observedr$s     r�assert_zSQLAsserter.assert_ks����u�~�����$�$���	0� ���Q���I��"�"�9�-�-�-���
0���"�
0�/�d�/�/�/�u�
�	0��	&�<�<�<�<�5��!�	&��#�#�%�%�%�%�%�	&�	&rN)rrrr&r�r�rrrr�r�csA������������&�&�&�&�&rr�c#����K�t���g�tj|d���fd���}tj|d����fd���}	�V�tj|d|��tj|d|������dS#tj|d|��tj|d|������wxYw)N�before_executec���|||f�dd�<dSr
r)�connr�r�r%�origs    �r�connection_executez)assert_engine.<locals>.connection_execute�s��� ��f�4��Q�Q�Q���r�after_cursor_executec�2��|sdS�jr"�jdj|ur�jd}n>t|�d�d�d��}�j�|��|j�t||||����dS)N���rr�r)r�rJr��appendr)r�)	r��cursorr$r*rJr��obs�asserterr�s	       ��r�cursor_executez%assert_engine.<locals>.cursor_execute�s�����	��F�
� �	-��$�R�(�0�G�;�;��&�r�*�C�C�$�W�d�1�g�t�A�w��Q��H�H�C�� �'�'��,�,�,�����$��:�w��
�
�	
�	
�	
�	
�	
r)r�r�listens_for�remover�)�enginer�r�r�r�s   @@r�
assert_enginer�|s�������}�}�H�
�D�
��v�/�0�0�5�5�5�5�1�0�5�
��v�5�6�6�
�
�
�
�
�7�6�
�*�����
��V�3�^�D�D�D�
��V�-�/A�B�B�B����������	��V�3�^�D�D�D�
��V�-�/A�B�B�B����������s
�B�AC)�collections�
contextlibr6r5rrr�r�engine.defaultr�engine.utilr�schemar	�objectrrr"r.rnrwr�r�r�r�r��
namedtupler�r��contextmanagerr�rrr�<module>r�s����������	�	�	�	�������������������+�+�+�+�+�+�)�)�)�)�)�)�!�!�!�!�!�!�

�

�

�

�

��

�

�

� 	�	�	�	�	�:�	�	�	�.�.�.�.�.��.�.�.�8}
�}
�}
�}
�}
�,�}
�}
�}
�@:�:�:�:�:�{�:�:�:�.+*�+*�+*�+*�+*��+*�+*�+*�\
�
�
�
�
�j�
�
�
� A�A�A�A�A�J�A�A�A�*5�5�5�5�5�Z�5�5�5�2A�A�A�A�A��A�A�A����������	�	�	�	�	��K��"�=�=�=���	�	�	�&�&�&�&�&�&�&�&�&�2��&�&���&�&�&r

Hacked By AnonymousFox1.0, Coded By AnonymousFox