%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/zope/interface/tests/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/zope/interface/tests/__pycache__/test_ro.cpython-312.pyc

�

��e)7���dZddlZGd�dej�ZGd�dej�ZGd�dej�ZGd	�d
�ZGd�de�ZGd
�dej�ZGd�dej�Z	y)z!Resolution ordering utility tests�Nc�*�eZdZd�Zd�Zd�Zd�Zd�Zy)�Test__mergeOrderingsc��ddlm}||�S)Nr)�_legacy_mergeOrderings)�zope.interface.ror)�self�	orderingsrs   �>/usr/lib/python3/dist-packages/zope/interface/tests/test_ro.py�_callFUTzTest__mergeOrderings._callFUTs��<�%�i�0�0�c�F�|j|jg�g�y�N��assertEqualr�rs r
�
test_emptyzTest__mergeOrderings.test_emptys��������r�*�B�/rc�N�|j|jgd��gd��y)N)�a�b�crrs r
�test_singlez Test__mergeOrderings.test_singles���������7��Irc�T�|j|jdgddgg�ddg�y)Nrrrrs r
�test_w_duplicatesz&Test__mergeOrderings.test_w_duplicatess*�����������S�z�':�;�c�3�Z�Hrc�p�gd�}ddg}gd�}dg}|j|j||||g�gd��y)N)�x�y�z�qr)���)rrrrr r!rr)r�O1�O2�O3�O4s     r
�&test_suffix_across_multiple_duplicatesz;Test__mergeOrderings.test_suffix_across_multiple_duplicates"sA��
���3�Z��
���U���������B��B�'7�8�6�	8rN)�__name__�
__module__�__qualname__rrrrr&�rr
rrs��1�0�J�I�8rrc�*�eZdZd�Zd�Zd�Zd�Zd�Zy)�
Test__flattenc��ddlm}||�S)Nr)�_legacy_flatten)rr.)r�obr.s   r
rzTest__flatten._callFUT-s��5��r�"�"rc�x�Gd�d�}|�}d|_|j|j|�|g�y)Nc��eZdZy)�-Test__flatten.test_w_empty_bases.<locals>.FooN�r'r(r)r*rr
�Foor22���rr4r*��	__bases__rr�rr4�foos   r
�test_w_empty_basesz Test__flatten.test_w_empty_bases1�5��	�	��e����
�������s�+�c�U�3rc�f�Gd�d�}|j|j|�|tg�y)Nc��eZdZy)�-Test__flatten.test_w_single_base.<locals>.FooNr3r*rr
r4r>9r5rr4�rr�object�rr4s  r
�test_w_single_basez Test__flatten.test_w_single_base8�)��	�	�������s�+�c�6�]�;rc�~�Gd�d�}Gd�d|�}|j|j|�||tg�y)Nc��eZdZy)�'Test__flatten.test_w_bases.<locals>.FooNr3r*rr
r4rF>r5rr4c��eZdZy)�'Test__flatten.test_w_bases.<locals>.BarNr3r*rr
�BarrH@r5rrIr?�rr4rIs   r
�test_w_baseszTest__flatten.test_w_bases=�8��	�	�	�#�	�������s�+�c�3��-?�@rc
��Gd�d�}Gd�d|�}Gd�d|�}Gd�d||�}|j|j|�|||t||tg�y)	Nc��eZdZy)�)Test__flatten.test_w_diamond.<locals>.FooNr3r*rr
r4rOEr5rr4c��eZdZy)�)Test__flatten.test_w_diamond.<locals>.BarNr3r*rr
rIrQGr5rrIc��eZdZy)�)Test__flatten.test_w_diamond.<locals>.BazNr3r*rr
�BazrSIr5rrTc��eZdZy)�)Test__flatten.test_w_diamond.<locals>.QuxNr3r*rr
�QuxrVKr5rrWr?�rr4rIrTrWs     r
�test_w_diamondzTest__flatten.test_w_diamondDs^��	�	�	�#�	�	�#�	�	�#�s�	�������s�+��s�C���c�6�B�	DrN)r'r(r)rr:rBrKrYr*rr
r,r,+s��#�4�<�
A�
Drr,c�@�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zy)
�Test_roNc� �ddlm}||fi|��S)Nr)�
_legacy_ro)rr])rr/�kwargsr]s    r
rzTest_ro._callFUTSs��0��"�'��'�'rc�x�Gd�d�}|�}d|_|j|j|�|g�y)Nc��eZdZy)�'Test_ro.test_w_empty_bases.<locals>.FooNr3r*rr
r4raXr5rr4r*r6r8s   r
r:zTest_ro.test_w_empty_basesWr;rc�f�Gd�d�}|j|j|�|tg�y)Nc��eZdZy)�'Test_ro.test_w_single_base.<locals>.FooNr3r*rr
r4rd_r5rr4r?rAs  r
rBzTest_ro.test_w_single_base^rCrc�~�Gd�d�}Gd�d|�}|j|j|�||tg�y)Nc��eZdZy)�!Test_ro.test_w_bases.<locals>.FooNr3r*rr
r4rgdr5rr4c��eZdZy)�!Test_ro.test_w_bases.<locals>.BarNr3r*rr
rIrifr5rrIr?rJs   r
rKzTest_ro.test_w_basescrLrc��Gd�d�}Gd�d|�}Gd�d|�}Gd�d||�}|j|j|�||||tg�y)	Nc��eZdZy)�#Test_ro.test_w_diamond.<locals>.FooNr3r*rr
r4rlkr5rr4c��eZdZy)�#Test_ro.test_w_diamond.<locals>.BarNr3r*rr
rIrnmr5rrIc��eZdZy)�#Test_ro.test_w_diamond.<locals>.BazNr3r*rr
rTrpor5rrTc��eZdZy)�#Test_ro.test_w_diamond.<locals>.QuxNr3r*rr
rWrrqr5rrWr?rXs     r
rYzTest_ro.test_w_diamondjsY��	�	�	�#�	�	�#�	�	�#�s�	�������s�+��s�C��f�5�	7rc��Gd�d�}|d�}|d|�}|d|�}|d|�}|d|�}|d|||�}|||||||gfS)	Nc��eZdZd�Zd�Zy)� Test_ro._make_IOErr.<locals>.Fooc� �||_||_yr�r'r7)r�name�basess   r
�__init__z)Test_ro._make_IOErr.<locals>.Foo.__init__y��� $��
�!&��rc��|jSr�r'rs r
�__repr__z)Test_ro._make_IOErr.<locals>.Foo.__repr__|����}�}�$rN)r'r(r)rzr~r*rr
r4ruxs��
'�
%rr4�IEx�IStdErr�IEnvErr�IIOErr�IOSErr�IOErrr*)rr4r�r�r�r�r�r�s        r
�_make_IOErrzTest_ro._make_IOErrvso��	%�	%��%�j���i��%���i��)���X�w�'���X�w�'���G�W�f�f�5���u�f�f�g�w��D�D�Drc�l�|j�\}}|j|j|�|�yr)r�rr)rr�rys   r
�test_non_orderablezTest_ro.test_non_orderable�s-���'�'�)���u�������u�-�u�5rc�`�ddlm}ddlm}ddlm}ddlm}Gd�d|�}||�Gd�d	��}Gd
�d|�}Gd�d
�}Gd�d||�}	|j|j
||	���||	�||�||�||||�|t�g�y)Nr)�implementer��	Interface��
providedBy)�
implementedByc��eZdZy)�?Test_ro.test_mixed_inheritance_and_implementation.<locals>.IFooNr3r*rr
�IFoor��r5rr�c��eZdZy)�HTest_ro.test_mixed_inheritance_and_implementation.<locals>.ImplementsFooNr3r*rr
�
ImplementsFoor��s��rr�c��eZdZy)�ETest_ro.test_mixed_inheritance_and_implementation.<locals>.ExtendsFooNr3r*rr
�
ExtendsFoor��r5rr�c��eZdZy)�LTest_ro.test_mixed_inheritance_and_implementation.<locals>.ImplementsNothingNr3r*rr
�ImplementsNothingr��r5rr�c��eZdZy)�VTest_ro.test_mixed_inheritance_and_implementation.<locals>.ExtendsFooImplementsNothingNr3r*rr
�ExtendsFooImplementsNothingr��r5rr�)�zope.interfacer�r�r�r�rrr@)
rr�r�r�r�r�r�r�r�r�s
          r
�)test_mixed_inheritance_and_implementationz1Test_ro.test_mixed_inheritance_and_implementation�s���	/�,�-�0�	�9�	�
�T�	�	�	�
�	�	��	�	�	�	�*�6G�	�	
����M�M�*�%@�%B�C�D�
�6�
7�
�:�
&�
�=�
)�
�
�
�,�
-�
�6�
"�

$�	%r)r'r(r)�maxDiffrr:rBrKrYr�r�r�r*rr
r[r[Qs1���G�(�4�<�
A�
7�E�(6�
!%rr[c��eZdZd�Zd�Zd�Zy)�	C3Settingc� �||_||_yr)�_setting�_value)r�setting�values   r
rzzC3Setting.__init__�s����
���rc�z�ddlm}t|j|jj
|j�y�Nr��ro)r�r��setattr�C3r�r'r�)rr�s  r
�	__enter__zC3Setting.__enter__�s#��%�����t�}�}�-�-�t�{�{�;rc�z�ddlm}t|j|jj
|j�yr�)r�r�r�r�r�r')r�t�v�tbr�s     r
�__exit__zC3Setting.__exit__�s#��%�����t�}�}�-�-�t�}�}�=rN)r'r(r)rzr�r�r*rr
r�r��s���<�>rr�c�Z��eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Z�fd�Z
�xZS)�
Test_c3_roc��tj|�ddlm}|d�x|_}|j|j�y)Nr)�InstalledHandlerzzope.interface.ro)r[�setUp�zope.testing.loggingsupportr��log_handler�
addCleanup�	uninstall)rr��handlers   r
r�zTest_c3_ro.setUp�s6���
�
�d��@�%5�6I�%J�J���7�����)�)�*rc� �ddlm}||fi|��Sr�)rr�)rr/r^r�s    r
rzTest_c3_ro._callFUT�s��(��"����rc�
�|}Gd�d|�}Gd�d|�}Gd�d|�}Gd�d||�}Gd	�d
||�}Gd�d||�}t|d
�r/|j|j�|j|��|S)Nc��eZdZy)�+Test_c3_ro._make_complex_diamond.<locals>.FNr3r*rr
�Fr��r5rr�c��eZdZy)�+Test_c3_ro._make_complex_diamond.<locals>.ENr3r*rr
�Er��r5rr�c��eZdZy)�+Test_c3_ro._make_complex_diamond.<locals>.DNr3r*rr
�Dr��r5rr�c��eZdZy)�+Test_c3_ro._make_complex_diamond.<locals>.CNr3r*rr
�Cr��r5rr�c��eZdZy)�+Test_c3_ro._make_complex_diamond.<locals>.BNr3r*rr
�Br��r5rr�c��eZdZy)�+Test_c3_ro._make_complex_diamond.<locals>.ANr3r*rr
�Ar��r5rr��mro)�hasattrrr�r)	r�base�Or�r�r�r�r�r�s	         r
�_make_complex_diamondz Test_c3_ro._make_complex_diamond�s�����	��	�	��	�	��	�	��1�	�	��1�	�	��1�	��1�e�����Q�U�U�W�d�m�m�A�&6�7��rc�.�|jt�yr)r�r@rs r
�test_complex_diamond_objectz&Test_c3_ro.test_complex_diamond_object�s���"�"�6�*rc��ddlm}|j|�}|j|jD�cgc]}|j
��c}gd��ycc}w)Nrr�)r�r�r�r�r�r�r�)r�r�r�r�__iro__r')rr��IArs    r
�test_complex_diamond_interfacez)Test_c3_ro.test_complex_diamond_interface�s?��,�
�
'�
'�	�
2�����!#���,�A�Q�Z�Z�,�7�	
��,s�Ac��ddlm}|j|�}|j|d��}|j	|j
|�|j
�y)Nrr�T)�
use_legacy_ro)r�r�r�r�assertNotEqualr��_check_handler_complex_diamond)rr�r��legacy_A_iros    r
�(test_complex_diamond_use_legacy_argumentz3Test_c3_ro.test_complex_diamond_use_legacy_argument�sI��,��&�&�y�1���}�}�Q�d�}�;�����A�I�I�|�4�	
�+�+�-rc���ddlm}|j|�}|j|d��}|j	t|�|j�|j�y)Nrr�T)�log_changed_ro)r�r�r�rr�tupler�r�)rr�r��computed_A_iros    r
�,test_complex_diamond_compare_legacy_argumentz7Test_c3_ro.test_complex_diamond_compare_legacy_argument�sL��,��&�&�y�1�����q���>������~�.��	�	�:��+�+�-rc��|j}|jdt|j��|jd}|jdj	d�|j�j
�D��d�y)Nrr�
c3�<K�|]}|j����y�wr)�rstrip)�.0�ls  r
�	<genexpr>z<Test_c3_ro._check_handler_complex_diamond.<locals>.<genexpr>s����"X�!�1�8�8�:�"X�s�a�Object <InterfaceClass zope.interface.tests.test_ro.A> has different legacy and C3 MROs:
  Legacy RO (len=7)                 C3 RO (len=7; inconsistent=no)
  ==================================================================
    zope.interface.tests.test_ro.A    zope.interface.tests.test_ro.A
    zope.interface.tests.test_ro.B    zope.interface.tests.test_ro.B
  - zope.interface.tests.test_ro.E
    zope.interface.tests.test_ro.C    zope.interface.tests.test_ro.C
    zope.interface.tests.test_ro.D    zope.interface.tests.test_ro.D
                                    + zope.interface.tests.test_ro.E
    zope.interface.tests.test_ro.F    zope.interface.tests.test_ro.F
    zope.interface.Interface          zope.interface.Interface)r�r�len�records�join�
getMessage�
splitlines)rr��records   r
r�z)Test_c3_ro._check_handler_complex_diamondsm���"�"������C����0�1�����#��������"X�v�7H�7H�7J�7U�7U�7W�"X�X�[B�	Crc�"�ddlm}Gd�d�}|ddi�}Gd�d|�}Gd	�d
|�}Gd�d|�}Gd
�d|�}|d�}|d|||f�}	|d|||	f�}
|j|
dd��}|j||
||	|||||g�|jj
\}|j
d|j��|j|j�5|j|
d��ddd�y#1swYyxYw)Nrr�c��eZdZdZdd�Zd�Zy)�UTest_c3_ro.test_ExtendedPathIndex_implement_thing_implementedby_super.<locals>._Basedr*Nc� �||_||_yrrw)rrxry�attrss    r
rzz^Test_c3_ro.test_ExtendedPathIndex_implement_thing_implementedby_super.<locals>._Based.__init__r{rc��|jSrr}rs r
r~z^Test_c3_ro.test_ExtendedPathIndex_implement_thing_implementedby_super.<locals>._Based.__repr__rr)r*N)r'r(r)r7rzr~r*rr
�_Basedr�s���I�
'�
%rr�r�r*c��eZdZy)�^Test_c3_ro.test_ExtendedPathIndex_implement_thing_implementedby_super.<locals>.IPluggableIndexNr3r*rr
�IPluggableIndexr�$r5rr�c��eZdZy)�bTest_c3_ro.test_ExtendedPathIndex_implement_thing_implementedby_super.<locals>.ILimitedResultIndexNr3r*rr
�ILimitedResultIndexr'r5rrc��eZdZy)�ZTest_c3_ro.test_ExtendedPathIndex_implement_thing_implementedby_super.<locals>.IQueryIndexNr3r*rr
�IQueryIndexr*r5rrc��eZdZy)�YTest_c3_ro.test_ExtendedPathIndex_implement_thing_implementedby_super.<locals>.IPathIndexNr3r*rr
�
IPathIndexr-r5rrr@�	PathIndex�ExtendedPathIndexTF)r��strictzused the legacy�r)
r�r�rrr�r��assertInr��assertRaises� InconsistentResolutionOrderError)
rr�r�r�r�rrr�objr	r
�resultr�s
             r
�:test_ExtendedPathIndex_implement_thing_implementedby_superzETest_c3_ro.test_ExtendedPathIndex_implement_thing_implementedby_supers4��%�	%�	%��;��B�/�	�	�i�	�	�/�	�	�/�	�	��	��X����;��[�#�(F�G�	�#�#6�$7��i�#P�R��
���0��e��T��������������"�	��"�"�*�*����
�
�'��):�):�)<�=�
�
�
�r�B�B�
C�	:��M�M�+�D�M�9�	:�	:�	:�s�(D�Dc	��ddlm}ddlm}|j	t|t
��j��|j|j|j|j|j|jg�y)Nr)�
interfacesr�)�zope.interface.commonrr�r�r�list�OSError�	flattened�IOSError�IIOError�IEnvironmentError�IStandardError�
IExceptionr�)rrr�s   r
�test_OSError_IOErrorzTest_c3_ro.test_OSError_IOErrorSsi��4�-������G�I�&�0�0�2�3��#�#��#�#��,�,��)�)��%�%��$�$�

�		rc	����ddl}ddlm}	|`|j�5|j
d�t|jjd�5t|jjd�5|j|j�5t�|�9�ddd�ddd�ddd�ddd�|j�\}}|j|j �5|j#|d��ddd�t|jj$d�5t|jjd�5|j�5|j
d�|j#|�ddd�|j'||jj(�ddd�ddd�|j#|d��}|j#|dd��}|j+||�y#t$rY���wxYw#1swY��ixYw#1swY��nxYw#1swY��sxYw#1swY��xxYw#1swY��;xYw#1swY��xYw#1swY��xYw#1swY��xYw)	Nrr��errorTFr�ignore)r�r)�warningsr�r��__warningregistry__�AttributeError�catch_warnings�simplefilterr�r��WARN_BAD_IRO�
STRICT_IROr�"InconsistentResolutionOrderWarning�superr�r�rr�
TRACK_BAD_IROr
�BAD_IROSr)rr"r�r��_�iro�
legacy_iro�	__class__s       �r
r�zTest_c3_ro.test_non_orderablebs
����%�	��&��
$�
$�
&�	1��!�!�'�*��2�5�5�-�-�t�4�
1�i����@P�@P�RW�6X�
1��&�&�r�'L�'L�M�1��G�.�0�1�
1�
1�	1��#�#�%���q�
�
�
�r�B�B�
C�	.��M�M�%��M�-�	.��r�u�u�*�*�D�
1�	1�9�R�U�U�=M�=M�u�3U�	1��(�(�*�
%��%�%�h�/��
�
�e�$�
%�
�M�M�%������0�		1�	1��m�m�E�%�m�0���]�]�5��U�]�K�
�����j�)��+�	��	��1�1��
1�
1��
1�
1��	1�	1��	.�	.��
%�
%��	1�	1��	1�	1�s��G4�2H+�!H�2H�H	�H�%H�-H+�+H8�'!I�I�#I�<.I�*I�4	H�H�H
�	H�H�H�H(	�#H+�+H5�8I�I�
I�I	�I�I&)r'r(r)r�rr�r�r�r�r�r�rrr��
__classcell__)r0s@r
r�r��sA���+� ��*+�
�.�.�C�$=:�~
�*�*rr�c� �eZdZdd�Zd�Zd�Zy)�TestC3Nc�4�ddlm}|j|||�S)Nr)r�)rr��resolver)rr�r�	base_mrosr�s     r
�_makeOnezTestC3._makeOne�s��(��{�{�1�f�i�0�0rc�<�|jt|�tjtjji��}|j
}|j
tj|�|j|tjj�y)N)r6)	r7�type�unittest�TestCase�__mro__�memor
�assertIsNone�had_inconsistency)r�c3r=s   r
�test_base_mros_givenzTestC3.test_base_mros_given�sk��
�]�]�4��:�(�2C�2C�X�EV�EV�E^�E^�1_�]�
`���w�w���
�
�h�'�'��.����$�x�0�0�1�C�C�Drc���|jt|��}|j|j�d|_|j|j
�tt|�j��yr)	r7r9�assertIsNotNone�_C3__mro�_mergerr�rr<)rr@s  r
�test_one_base_optimizationz!TestC3.test_one_base_optimization�sT��
�]�]�4��:�
&��	
���R�[�[�)���	��������4��T�
�(:�(:�#;�<r)FN)r'r(r)r7rArFr*rr
r3r3�s��1�E�=rr3c�.�eZdZGd�d�Zdd�Zd�Zy)�Test_ROComparisonc��eZdZdZdZy)�Test_ROComparison.MockC3FN)r'r(r)�direct_inconsistency�bases_had_inconsistencyr*rr
�MockC3rJ�s��$��"'�rrMNc�F�ddlm}||xs|j�||�S)Nr)�
_ROComparison)rrOrM)rr@�c3_ro�	legacy_rorOs     r
r7zTest_ROComparison._makeOne�s��3��R�0�4�;�;�=�%��C�Crc�j�|j�}|jd|j�d|j_|jd|j�d|j_|jd|j�d|j_|jd|j�y)N�noT�directzdirect+basesFry)r7r�_inconsistent_labelr@rKrL)r�comps  r
�test_inconsistent_labelz)Test_ROComparison.test_inconsistent_label�s����}�}�������t�7�7�8�'+����$�����4�#;�#;�<�*.����'������)A�)A�B�',����$�����$�":�":�;r)Nr*r*)r'r(r)rMr7rWr*rr
rHrH�s��(�(�D�<rrH)
�__doc__r:r;rr,r[r�r�r3rHr*rr
�<module>rYs���(��8�8�,�,�8�0#D�H�%�%�#D�L_%�h���_%�D>�>�|*��|*�~=�X�
�
�=�*<��)�)�<r

Zerion Mini Shell 1.0