AnonSec Shell
Server IP : 209.38.156.173  /  Your IP : 216.73.216.122   [ Reverse IP ]
Web Server : Apache/2.4.52 (Ubuntu)
System : Linux lakekumayuhotel 5.15.0-136-generic #147-Ubuntu SMP Sat Mar 15 15:53:30 UTC 2025 x86_64
User : root ( 0)
PHP Version : 8.1.2-1ubuntu2.22
Disable Function : NONE
Domains : 2 Domains
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /lib/python3/dist-packages/zope/interface/tests/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     [ BACKUP SHELL ]     [ JUMPING ]     [ MASS DEFACE ]     [ SCAN ROOT ]     [ SYMLINK ]     

Current File : /lib/python3/dist-packages/zope/interface/tests/__pycache__/test_adapter.cpython-310.pyc
o

$
x`�7�@s$dZddlZddlmZdd�ZGdd�de�ZGdd	�d	e�ZGd
d�de�ZGdd
�d
e�Z	Gdd�de�Z
Gdd�dej�ZGdd�de�Z
Gdd�dej�ZGdd�dee�ZGdd�dej�ZGdd�dee�ZGdd�dej�ZGdd�dej�ZGd d!�d!e�ZGd"d#�d#ej�ZdS)$zAdapter registry tests
�N)�OptimizationTestMixinc
	Cs�ddlm}Gdd�d|�}Gdd�d|�}Gdd�d|�}Gd	d
�d
||�}Gdd�d||�}Gd
d�d|�}Gdd�d|�}Gdd�d|�}Gdd�d|�}	|||||||||	f	S)Nr��	Interfacec@�eZdZdS)z_makeInterfaces.<locals>.IB0N��__name__�
__module__�__qualname__�r
r
�C/usr/lib/python3/dist-packages/zope/interface/tests/test_adapter.py�IB0�rc@r)z_makeInterfaces.<locals>.IB1Nrr
r
r
r�IB1r
rc@r)z_makeInterfaces.<locals>.IB2Nrr
r
r
r�IB2r
rc@r)z_makeInterfaces.<locals>.IB3Nrr
r
r
r�IB3 r
rc@r)z_makeInterfaces.<locals>.IB4Nrr
r
r
r�IB4"r
rc@r)z_makeInterfaces.<locals>.IF0Nrr
r
r
r�IF0%r
rc@r)z_makeInterfaces.<locals>.IF1Nrr
r
r
r�IF1'r
rc@r)z_makeInterfaces.<locals>.IR0Nrr
r
r
r�IR0*r
rc@r)z_makeInterfaces.<locals>.IR1Nrr
r
r
r�IR1,r
r)�zope.interfacer)
rrrrrrrrrrr
r
r�_makeInterfacessrc@sHeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dS)�CustomDataTypeBaseNcCs
|j|S�N��_data��self�namer
r
r�__getitem__7�
zCustomDataTypeBase.__getitem__cCs||j|<dSrr)rr�valuer
r
r�__setitem__:�zCustomDataTypeBase.__setitem__cCs|j|=dSrrrr
r
r�__delitem__=�zCustomDataTypeBase.__delitem__cC�
t|j�Sr)�lenr�rr
r
r�__len__@r zCustomDataTypeBase.__len__cCs
||jvSrrrr
r
r�__contains__Cr zCustomDataTypeBase.__contains__cCs,||urdSt|�t|�krdS|j|jkS)NTF)�typer�r�otherr
r
r�__eq__Fs
zCustomDataTypeBase.__eq__cCr&r)�reprrr(r
r
r�__repr__Nr zCustomDataTypeBase.__repr__)rrr	rrr"r$r)r*r.r0r
r
r
rr5src@�eZdZddd�ZdS)�
CustomMappingNcCs.i|_|r|j�|�|jj|_|jj|_dSr)r�update�get�itemsr,r
r
r�__init__Rs

zCustomMapping.__init__r�rrr	r6r
r
r
rr2Q�r2c@r1)�CustomSequenceNcCs$g|_|r|j�|�|jj|_dSr)r�extend�appendr,r
r
rr6[szCustomSequence.__init__rr7r
r
r
rr9Zr8r9c@r)�CustomLeafSequenceNrr
r
r
rr<ar
r<c@r)�CustomProvidedNrr
r
r
rr=dr
r=c@sdeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�ZdWdd�ZdWdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�Zd7d8�Zd9d:�Zd;d<�Z d=d>�Z!d?d@�Z"dAdB�Z#dCdD�Z$dEdF�Z%dGdH�Z&dIdJ�Z'dKdL�Z(dMdN�Z)dOdP�Z*dQdR�Z+dSdT�Z,dUdV�Z-dS)X�BaseAdapterRegistryTestsNcC�ddlm}|S)Nr��BaseAdapterRegistry��zope.interface.adapterrA)rrAr
r
r�_getBaseAdapterRegistryl�z0BaseAdapterRegistryTests._getBaseAdapterRegistrycCs8|��}Gdd�d|�}|jD]
}t|j|t��q|S)Nc@seZdZGdd�de�ZdS)z6BaseAdapterRegistryTests._getTargetClass.<locals>._CUTc@s4eZdZdZZdd�Zdd�Zdd�Zdd	�Zd
S)zBBaseAdapterRegistryTests._getTargetClass.<locals>._CUT.LookupClassr
cS�dSrr
)r�regr
r
rr6u�zKBaseAdapterRegistryTests._getTargetClass.<locals>._CUT.LookupClass.__init__cS�|j|f7_dSr��_changed)r�origr
r
r�changedw�zJBaseAdapterRegistryTests._getTargetClass.<locals>._CUT.LookupClass.changedcSrIr)�
_extendors�r�providedr
r
r�add_extendoryrNzOBaseAdapterRegistryTests._getTargetClass.<locals>._CUT.LookupClass.add_extendorcst�fdd�|jD��|_dS)Ncsg|]}|�kr|�qSr
r
)�.0�x�rQr
r�
<listcomp>|s
�zfBaseAdapterRegistryTests._getTargetClass.<locals>._CUT.LookupClass.remove_extendor.<locals>.<listcomp>)�tuplerOrPr
rUr�remove_extendor{szRBaseAdapterRegistryTests._getTargetClass.<locals>._CUT.LookupClass.remove_extendorN)	rrr	rKrOr6rMrRrXr
r
r
r�LookupClassssrYN)rrr	�objectrYr
r
r
r�_CUTrsr[)rD�
_delegated�setattrrYrZ)rrAr[rr
r
r�_getTargetClassps

z(BaseAdapterRegistryTests._getTargetClasscCs
|���Sr�r^r(r
r
r�_makeOne�r z!BaseAdapterRegistryTests._makeOnecC�tSr��dictr(r
r
r�_getMappingType�rHz(BaseAdapterRegistryTests._getMappingTypecCrarrbr(r
r
r�_getProvidedType�rHz)BaseAdapterRegistryTests._getProvidedTypecCrar)�listr(r
r
r�_getMutableListType�rHz,BaseAdapterRegistryTests._getMutableListTypecCrar)rWr(r
r
r�_getLeafSequenceType�rHz-BaseAdapterRegistryTests._getLeafSequenceTypecCs8|��}|�}|jD]}|�t||�t|j|��q
dSr)r^r\�assertIs�getattr�	_v_lookup)r�CUT�registryrr
r
r�test_lookup_delegation�s

�z/BaseAdapterRegistryTests.test_lookup_delegationcCs|��}|�|jd�dS�N�)r`�assertEqual�_generation�rrmr
r
r�"test__generation_on_first_creation�sz;BaseAdapterRegistryTests.test__generation_on_first_creationcCs>|��}t�}|�|�|�|jd�|�|jj||f�dS�N�)r`rZrMrqrrrkrK)rrmrLr
r
r�&test__generation_after_calling_changed�s

z?BaseAdapterRegistryTests.test__generation_after_calling_changedcCs2Gdd�dt�}|��}|f|_|�|jd�dS)Nc@r)zQBaseAdapterRegistryTests.test__generation_after_changing___bases__.<locals>._BaseNrr
r
r
r�_Base�r
rxrv)rZr`�	__bases__rqrr)rrxrmr
r
r�)test__generation_after_changing___bases__�szBBaseAdapterRegistryTests.test__generation_after_changing___bases__rvcCs�|�t|j�|�|�|j|���|��}|jD]}|�||�q|�|jd|��|�|jd|�|�t|j|d�d�dS�Nrrp)rqr'�	_adapters�assertIsInstancergrd�rrm�expected_order�MT�mappingr
r
r�_check_basic_types_of_adapters�s
z7BaseAdapterRegistryTests._check_basic_types_of_adapterscCs�|�t|j�|�|�|j|���|��}|jD]}|�||�q|rF|�|jd|��|�|jd|�|�t|j|d�d�dSdSr{)rqr'�_subscribersr}rgrdr~r
r
r�!_check_basic_types_of_subscribers�s
�z:BaseAdapterRegistryTests._check_basic_types_of_subscribersc
Cs�t�\	}}}}}}}}}	|��}
|
�|g|dd�|�|
�|g|d�d�|�|
jd�|�|
�|��}|�|
jd|||||ddi�i�i��|�	�}|�|
j
||di��t|
���}
|�|
|f|ddfg�dS)N��A1rvrp)
rr`�registerrq�
registeredrrr�rdr|re�	_providedrf�allRegistrations)rrrrrrrrrrrmr��PTr�r
r
r�
test_register�s.
��
��z&BaseAdapterRegistryTests.test_registerc
s$t�\	����}}}��|��}|�g�dd�|�g�dd�|��g�dd�|��g�dd�|��g�dd�|��g�dd�|���g�dd�|���g�dd�|���g�d	d�|���g�dd�������fd
d�}|�|j||��|��d��t|���}|�|d
�ddfd
�ddf�f�ddf�f�ddf�f�ddf�f�ddf��f�ddf��f�ddf��f�d	df��f�ddfg
�|��}|D]}|j|�q�|�|j|j�|�|j	|j	�t
|_t|_
t|_t|_dd�}	|	|_|��|�|j|tt
d��dS)Nr�r��name1�A2�name2�A3�name3�A4�name4cs�||�|ddd��i�|�|�|ddd���|ddd��i�i�|�|�|�|ddi�i��|�|d	di��|d
di�i��|�|ddi�i�i�i�g�S)Nr�r�)r�r�)r�r�r�r�)r�r�r�r�r�r
��Lr��rrrrrrr
r�build_adapters�sD������
������zXBaseAdapterRegistryTests.test_register_multiple_allRegistrations.<locals>.build_adaptersr�r
cS� |dur|nt�}|�|�|Sr�r<r;��existing�newr
r
r�addValue1�
zRBaseAdapterRegistryTests.test_register_multiple_allRegistrations.<locals>.addValue)rr`r�rqr|rgrd�sortedr�r�r2�_mappingTyper<�_leafSequenceTyper9�
_sequenceTyper=�
_providedType�_addValueToLeaf�rebuild)
rrrrrmr�r��	registry2�argsr�r
r�r�'test_register_multiple_allRegistrations�sb'��

���z@BaseAdapterRegistryTests.test_register_multiple_allRegistrationsc	Csdt�\	}}}}}}}}}	|��}
|�t��|
�|g|t�d�Wd�dS1s+wYdS�Nr�)rr`�assertRaises�
ValueErrorr�rZ�rrrrrrrrrrrmr
r
r�test_register_with_invalid_name?s
"�z8BaseAdapterRegistryTests.test_register_with_invalid_namec	Cs�t�\	}}}}}}}}}	|��}
|
�dg|dd�|
�dg|dd�|�t|
j�d�|�|
j|���t|
�	��}|�|g�dS)Nr�r�r)
rr`r�rqr'r|r}rgrfr�)rrrrrrrrrrrmr�r
r
r�)test_register_with_value_None_unregistersEszBBaseAdapterRegistryTests.test_register_with_value_None_unregistersc
Cs�ddlm}t�\	}}}}}}}}	}
|��}t�}|�dg|	d|�|j}
|�dg|	d|�|�|j|
�|�|�|�	�}|�|j
d||||	|d|i�i�i��t|���}|�||f|	d|fg�dS)Nrrr�rp)
rrrr`rZr�rrrqr�rdr|rfr�)rrrrrrrrrrrrm�_value�_beforer�r�r
r
r�test_register_with_same_valueOs0
����	�z6BaseAdapterRegistryTests.test_register_with_same_valuecCs<|��}|�|�dgdd�d�t|���}|�|g�dS�Nr�)r`rqr�rfr�)rrmr�r
r
r�test_registered_emptylsz.BaseAdapterRegistryTests.test_registered_emptyc	CsNt�\	}}}}}}}}}	|��}
|
�|gddd�|�|
�|gdd�d�dS�Nr�r�)rr`r�rqr�r�r
r
r�test_registered_non_empty_missrsz7BaseAdapterRegistryTests.test_registered_non_empty_misscCs6|��}|�dgddd�|�|�dgdd�d�dSr�)r`r�rqr�rsr
r
r�test_registered_non_empty_hitxsz6BaseAdapterRegistryTests.test_registered_non_empty_hitcCsF|��}|�dgdd�|�|�dgdd�d�|�t|j�d�dS)Nr�r)r`�
unregisterrqr�r'r�rsr
r
r�test_unregister_empty}sz.BaseAdapterRegistryTests.test_unregister_emptyc

Cs�t�\	}}}}}}}}}	|��}
|
�|gddd�|
�|gdd�|�|
�|gdd�d�|�|
�|��}|�|
jd|||d|ddi�i�i��|�	�}|�|
j
|ddi��dS)Nr�r�rp�rr`r�r�rqr�r�rdr|rer��
rrrrrrrrrrrmr�r�r
r
r�*test_unregister_non_empty_miss_on_required��$
����	
�zCBaseAdapterRegistryTests.test_unregister_non_empty_miss_on_requiredc

Cs�t�\	}}}}}}}}}	|��}
|
�|gddd�|
�|gdd�|�|
�|gdd�d�|�|
�|��}|�|
jd|||d|ddi�i�i��|�	�}|�|
j
|ddi��dS)Nr�r��nonesuchrpr�r�r
r
r�&test_unregister_non_empty_miss_on_name�r�z?BaseAdapterRegistryTests.test_unregister_non_empty_miss_on_namec
	Cslt�\	}}}}}}}}}	|��}
t�}t�}|
�|gdd|�|
�|gdd|�|�|
�|gdd�|�dSr�)rr`rZr�r�rir��
rrrrrrrrrrrmrL�nomatchr
r
r�(test_unregister_with_value_not_None_miss�szABaseAdapterRegistryTests.test_unregister_with_value_not_None_misscCs�t�\	}}}}}}}}}	|��}
t�}t�}|
�||gdd|�|
�||gdd|�|j|
dd�|�||
jd|�|�||
jd|�|��}
|�|
jd|
||
||
d|
d|i�i�||
d|
d|i�i�i�i��|�	�}|�|
j
|ddi��|
�||gdd|�|�||
jd|�|�||
jd|�|�|
jd|
||
||
d|
d|i�i�i�i��|�|
j
|ddi��dS)Nr���rrvrp)
rr`rZr�r��assertInr|rdrqrer�r��assertNotIn)rrrrrrrrrrrm�one�anotherr�r�r
r
r�.test_unregister_hit_clears_empty_subcomponents�sF����

�����
	�zGBaseAdapterRegistryTests.test_unregister_hit_clears_empty_subcomponentscCsB|��}|�dgdd�|�|�dgdd�d�|j|dd�dS)Nr�rr�)r`�unsubscriberqr�r�rsr
r
r�test_unsubscribe_empty�sz/BaseAdapterRegistryTests.test_unsubscribe_emptycCs�t�\	}}}}}}}}}	|��}
t�}|
�|gd|�|��}|��}
|��}|�|
�|�|
j	d|||d|d|
|f�i�i�i��|�|
j
|i��|
�|gd|�|�t|
j	�d�|�|
j
|i��dS)Nrpr�r)
rr`rZ�	subscriberdrhrer�rqr�r�r�r')rrrrrrrrrrrmrLr�r�r�r
r
r�test_unsubscribe_hit�s&

���z-BaseAdapterRegistryTests.test_unsubscribe_hitcCs|�||�dS)a�
        Implementations may choose to use new, immutable objects
        instead of mutating existing subscriber leaf objects, or vice versa.

        The default implementation uses immutable tuples, so they are never
        the same. Other implementations may use persistent lists so they should be
        the same and mutated in place. Subclasses testing this behaviour need to
        override this method.
        N)�assertIsNot�r�leaf1�leaf2r
r
r�assertLeafIdentity�s
z+BaseAdapterRegistryTests.assertLeafIdentitycCs*t�\	}}}}}}}}}	|��}
t�}t�}t�}
t�}|
�|gd|�|
�|gd|�|
�|g||
�|
�|g||�|j|
dd�|��}|��}|��}|�|
j	d|||d|d|||f�i�||d||
|f�i�i�i��|�|
j
||di��|
j	d||d}|
j	d|dd}|
�|gd|�|
�|g||
�|�|
j	d|||d|d||f�i�||d||f�i�i�i��|�|
j
||di��|
j	d||d}|
j	d|dd}|�||�|�||�|
�|gd|�|
�|g||�|�t
|
j	�d�|�t
|
j
�d�dS)Nrvr�rpr�r)rr`rZr�r�rdrhrerqr�r�r�r�r')rrrrrrrrrrrm�first�second�third�fourthr�r�r��
IR0_leaf_orig�
Non_leaf_orig�IR0_leaf_new�Non_leaf_newr
r
r�test_unsubscribe_after_multiple	sX��
���
�z8BaseAdapterRegistryTests.test_unsubscribe_after_multiplecCs�t�\	}}}}}}}}}	|��}
t�}|
�|g||�|
�|g||�|��}|��}
|��}|�|
jd|||||d|
||f�i�i�i��|�|
j	||di��|
�
|g||�|
�
|g||�|�t|
j�d�|�|
j	|��dS�Nrpr�rvr�rr`rZr�rdrhrerqr�r�r�r')rrrrrrrrrrrmr�r�r�r�r
r
r�5test_subscribe_unsubscribe_identical_objects_provided=s(��
�zNBaseAdapterRegistryTests.test_subscribe_unsubscribe_identical_objects_providedcCs�t�\	}}}}}}}}}	|��}
t�}t�}|
�|g||�|
�|g||�|��}
|��}|��}|�|
jd|
||
||
d|||f�i�i�i��|�|
j	||di��|
�
|g||�|
�
|g||�|�t|
j�d�|�|
j	|��dSr�r�)rrrrrrrrrrrmr�r�r�r�r�r
r
r�4test_subscribe_unsubscribe_nonequal_objects_providedVs*��
�zMBaseAdapterRegistryTests.test_subscribe_unsubscribe_nonequal_objects_providedcCs:|��}|�|�dgdd��t|���}|�|g�dSr�)r`�assertIsNone�
subscribedrf�allSubscriptionsrq)rrmr�r
r
r�test_subscribed_emptypsz.BaseAdapterRegistryTests.test_subscribed_emptyc	Csvt�\	}}}}}}}}}	|��}
|
�|g|d�|�|
�|g|d��|�|
�|g|d��|�|
�|g|d��dS)Nr�r�)rr`r�r�r�r�r
r
r�test_subscribed_non_empty_missvsz7BaseAdapterRegistryTests.test_subscribed_non_empty_missc	CsLt�\	}}}}}}}}}	|��}
|
�|g|d�|�|
�|g|d�d�dSr�)rr`r�rqr�r�r
r
r�test_subscribed_non_empty_hit�sz6BaseAdapterRegistryTests.test_subscribed_non_empty_hitc
	Cs~t�\	}}}}}}}}}	|��}
t�}t�}|
�|gd|�|
�|gd|�|j|
dd�|
�|gd�|�t|
j�d�dS)Nrvr�r)	rr`rZr�r�r�rqr'r�)
rrrrrrrrrrrmr�r�r
r
r�&test_unsubscribe_w_None_after_multiple�sz?BaseAdapterRegistryTests.test_unsubscribe_w_None_after_multiplec
Cs�t�\	}}}}}}}}}	|��}
|
�|gdd�|j|
dd�|
�|gdd�|�t|
j�d�|��}|�	�}|�|
jd|||d|d|d�i�i�i��dS)Nr�rvr�r�rp�r��
rr`r�r�r�rqr'r�rdrh�
rrrrrrrrrrrmr�r�r
r
r�+test_unsubscribe_non_empty_miss_on_required����zDBaseAdapterRegistryTests.test_unsubscribe_non_empty_miss_on_requiredc
Cs�t�\	}}}}}}}}}	|��}
|
�|gdd�|j|
dd�|
�|gdd�|�t|
j�d�|��}|�	�}|�|
jd|||d|d|d�i�i�i��dS)Nr�rvr�r�rpr�r�r�r�r
r
r�(test_unsubscribe_non_empty_miss_on_value�r�zABaseAdapterRegistryTests.test_unsubscribe_non_empty_miss_on_valuec
	Csbt�\	}}}}}}}}}	|��}
t�}t�}|
�|gd|�|
�|gd|�|�t|
j�d�dSru)rr`rZr�r�rqr'r�r�r
r
r�)test_unsubscribe_with_value_not_None_miss�szBBaseAdapterRegistryTests.test_unsubscribe_with_value_not_None_misscC�|�d�dS)Nz*Example method, not intended to be called.��failr(r
r
r�_instance_method_notify_target�r#z7BaseAdapterRegistryTests._instance_method_notify_targetc	Cslt�\	}}}}}}}}}	|��}
|�t|
j�d�|
�|gd|j�|
�|gd|j�|�t|
j�d�dS�Nr)rr`rqr'r�r�r�r�r�r
r
r� test_unsubscribe_instance_method�sz9BaseAdapterRegistryTests.test_unsubscribe_instance_methodcs*t�\	����}}}��|��}|�g�d�|�g�d�|��g�d�|��g�d�|��g�d�|��g�d�|���g�d�|���g�d�|���g�d�|���g�d�������fdd�}|�|j||��|��|��d����fdd	�}|�|j||�	�d
��t
|���}|�|d�dfd�df�f�df�f�df�f�df�f�df��f�df��f�df��f�df��f�dfg
�|��}|D]}	|j|	�q�|�|j|j�|�|j|j�t|_
t|_t|_t|_dd
�}
|
|_|��|�|j|tttd��dS)Nr�r�r�r�cs�||�|d|ddg�i�i�|�|�|d|ddg�i��|d|ddg�i�i�i�|�|�|�|d|dg�i�i��|�|d|dg�i��|d|dg�i�i��|�|d|dg�i�i�i�i�g�S)Nr�r�r�r�r�r
�r��Fr�r�r
r�build_subscribers�s>������������z\BaseAdapterRegistryTests.test_subscribe_multiple_allRegistrations.<locals>.build_subscribersr�cs|�d�di�S)N��r
��P)rrr
r�build_provideds�zYBaseAdapterRegistryTests.test_subscribe_multiple_allRegistrations.<locals>.build_providedr�r
cSr�rr�r�r
r
rr�(r�zSBaseAdapterRegistryTests.test_subscribe_multiple_allRegistrations.<locals>.addValue)rr`r�rqr�rgrhrdr�rer�r�r2r�r<r�r9r�r=r�r�r�)rrrrrmr�r�r�r�r�r�r
r�r�(test_subscribe_multiple_allRegistrations�sp$���



���zABaseAdapterRegistryTests.test_subscribe_multiple_allRegistrations)rv).rrr	�maxDiffrDr^r`rdrergrhrnrtrwrzr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r
r
r
rr>hsX


e
	*4		r>c@s@eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dS)�#CustomTypesBaseAdapterRegistryTestsz�
    This class may be extended by other packages to test their own
    adapter registries that use custom types. (So be cautious about
    breaking changes.)

    One known user is ``zope.component.persistentregistry``.
    cCrar)r2r(r
r
rrdArHz3CustomTypesBaseAdapterRegistryTests._getMappingTypecCrar)r=r(r
r
rreDrHz4CustomTypesBaseAdapterRegistryTests._getProvidedTypecCrar)r9r(r
r
rrgGrHz7CustomTypesBaseAdapterRegistryTests._getMutableListTypecCrar)r<r(r
r
rrhJrHz8CustomTypesBaseAdapterRegistryTests._getLeafSequenceTypecs&ddlm�G��fdd�d��}|S)Nrr@cs@eZdZ���Z���Z���Z��	�Z
dd�Z�fdd�ZdS)zZCustomTypesBaseAdapterRegistryTests._getBaseAdapterRegistry.<locals>.CustomAdapterRegistrycSs|s|��}|�|�|Sr)r�r;)r�existing_leaf_sequence�new_itemr
r
rr�Us
zjCustomTypesBaseAdapterRegistryTests._getBaseAdapterRegistry.<locals>.CustomAdapterRegistry._addValueToLeafcs*��|||�}||dd�<||vsJ�|Sr)�_removeValueFromLeaf)rr��	to_remove�without_removedr@r
rr[s�zoCustomTypesBaseAdapterRegistryTests._getBaseAdapterRegistry.<locals>.CustomAdapterRegistry._removeValueFromLeafN)
rrr	rdr�rgr�rhr�rer�r�rr
�rArr
r�CustomAdapterRegistryOsrrB)rrr
rrrDMsz;CustomTypesBaseAdapterRegistryTests._getBaseAdapterRegistrycCs|�||�dSr)rir�r
r
rr�fsz6CustomTypesBaseAdapterRegistryTests.assertLeafIdentityN)
rrr	�__doc__rdrergrhrDr�r
r
r
rr�8sr�cs�eZdZdd�ZeZ		d:dd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Z�fd.d/�Zd0d1�Zd2d3�Zd4d5�Zd6d7�Zd8d9�Z�Z S);�LookupBaseFallbackTestscCr?)Nr)�LookupBaseFallback)rCr)rrr
r
r�_getFallbackClasslrEz)LookupBaseFallbackTests._getFallbackClassNcsR�durdd���durdd���durdd��G���fdd�d|���}|�S)	NcSrFrr
�r�requiredrQrr
r
r�	uc_lookupvrHz3LookupBaseFallbackTests._makeOne.<locals>.uc_lookupcS�t��r��NotImplementedError�rr
rQr
r
r�uc_lookupAlly�z6LookupBaseFallbackTests._makeOne.<locals>.uc_lookupAllcSrrr
rr
r
r�uc_subscriptions|rz:LookupBaseFallbackTests._makeOne.<locals>.uc_subscriptionscseZdZ�Z�Z�ZdS)z1LookupBaseFallbackTests._makeOne.<locals>.DerivedN)rrr	�_uncached_lookup�_uncached_lookupAll�_uncached_subscriptionsr
�rrrr
r�Derived~srr_)rrrrrr
rrr`rsz LookupBaseFallbackTests._makeOnecC�Tdd�}|j|d�}|�t��|�ddt��Wd�dS1s#wYdS)NcSr��NzThis should never be calledr�r	r
r
r�_lookup�r#zCLookupBaseFallbackTests.test_lookup_w_invalid_name.<locals>._lookup�r��A�B)r`r�r��lookuprZ�rr�lbr
r
r�test_lookup_w_invalid_name�s
"�z2LookupBaseFallbackTests.test_lookup_w_invalid_namec�Fg��fdd�}|j|d�}|�ddd�}|�|�|��dg�dS)Nc���|||f�dSr�r;r	��_called_withr
rr�rNzDLookupBaseFallbackTests.test_lookup_miss_no_default.<locals>._lookuprrr�C�rrr()r`rr�rq�rrr!�foundr
r&r�test_lookup_miss_no_default��
z3LookupBaseFallbackTests.test_lookup_miss_no_defaultc�Pg�t�}�fdd�}|j|d�}|�ddd|�}|�||�|��dg�dS)Ncr$rr%r	r&r
rr�rNzCLookupBaseFallbackTests.test_lookup_miss_w_default.<locals>._lookuprrrr(r)�rZr`rrirq�r�_defaultrr!r+r
r&r�test_lookup_miss_w_default��z2LookupBaseFallbackTests.test_lookup_miss_w_defaultc�zg�t�t�t�}}}|||g���fdd�}|j|d�}|�ddd�}|�||�|��dg�|��||g�dS)Nc���|||f���d�Sr��r;�popr	�r'�_resultsr
rr��
z?LookupBaseFallbackTests.test_lookup_not_cached.<locals>._lookuprrrr(r)r/�r�a�b�crr!r+r
r8r�test_lookup_not_cached��
z.LookupBaseFallbackTests.test_lookup_not_cachedc�g�t�t�t�}}}|||g���fdd�}|j|d�}|�ddd�}|�ddd�}|�||�|��dg�|��||g�dS)Ncr5r�r6r	r8r
rr�r:z;LookupBaseFallbackTests.test_lookup_cached.<locals>._lookuprrrr(r)r/r;r
r8r�test_lookup_cached��
z*LookupBaseFallbackTests.test_lookup_cachedcr4)Ncr5r�r6r	r8r
rr�r:zNLookupBaseFallbackTests.test_lookup_not_cached_multi_required.<locals>._lookupr�r�Drr(�rDrr(r/r;r
r8r�%test_lookup_not_cached_multi_required�r@z=LookupBaseFallbackTests.test_lookup_not_cached_multi_requiredcrA)Ncr5r�r6r	r8r
rr�r:zJLookupBaseFallbackTests.test_lookup_cached_multi_required.<locals>._lookuprrDrr(rFr/r;r
r8r�!test_lookup_cached_multi_required�rCz9LookupBaseFallbackTests.test_lookup_cached_multi_requiredc�g�t�t�t�}}}|||g���fdd�}|j|d�}|�ddd�}|�|�|�ddd�}|�||�|��ddg�|��|g�dS)Ncr5r�r6r	r8r
rr�r:zMLookupBaseFallbackTests.test_lookup_not_cached_after_changed.<locals>._lookuprrrr(r))rZr`rrMrirqr;r
r8r�$test_lookup_not_cached_after_changed��

�z<LookupBaseFallbackTests.test_lookup_not_cached_after_changedcCr)NcSr�rr�r	r
r
rr�r#zDLookupBaseFallbackTests.test_lookup1_w_invalid_name.<locals>._lookuprrr)r`r�r��lookup1rZr r
r
r�test_lookup1_w_invalid_name�s
"�z3LookupBaseFallbackTests.test_lookup1_w_invalid_namecr#)Ncr$rr%r	r&r
rr�rNzELookupBaseFallbackTests.test_lookup1_miss_no_default.<locals>._lookuprrrr(r))r`rLr�rqr*r
r&r�test_lookup1_miss_no_default�r-z4LookupBaseFallbackTests.test_lookup1_miss_no_defaultcr.)Ncr$rr%r	r&r
rr�rNzDLookupBaseFallbackTests.test_lookup1_miss_w_default.<locals>._lookuprrrr(r)�rZr`rLrirqr0r
r&r�test_lookup1_miss_w_default�r3z3LookupBaseFallbackTests.test_lookup1_miss_w_defaultcslg�t�}�fdd�}|j|d�}|�ddd|�}|�||�|�ddd|�}|�||�|��dg�dS)Ncr$rr%r	r&r
rrrNzSLookupBaseFallbackTests.test_lookup1_miss_w_default_negative_cache.<locals>._lookuprrrr(r)rOr0r
r&r�*test_lookup1_miss_w_default_negative_cacheszBLookupBaseFallbackTests.test_lookup1_miss_w_default_negative_cachecr4)Ncr5r�r6r	r8r
rrr:z@LookupBaseFallbackTests.test_lookup1_not_cached.<locals>._lookuprrrr(r)rOr;r
r8r�test_lookup1_not_cachedr@z/LookupBaseFallbackTests.test_lookup1_not_cachedcrA)Ncr5r�r6r	r8r
rr!r:z<LookupBaseFallbackTests.test_lookup1_cached.<locals>._lookuprrrr(r)rOr;r
r8r�test_lookup1_cachedrCz+LookupBaseFallbackTests.test_lookup1_cachedcrI)Ncr5r�r6r	r8r
rr/r:zNLookupBaseFallbackTests.test_lookup1_not_cached_after_changed.<locals>._lookuprrrr(r))rZr`rLrMrirqr;r
r8r�%test_lookup1_not_cached_after_changed+rKz=LookupBaseFallbackTests.test_lookup1_not_cached_after_changedcCsVt�t�}}|��}|�t��|�||t��Wd�dS1s$wYdSr)rZr`r�r��adapter_hook)r�req�prvr!r
r
r� test_adapter_hook_w_invalid_name;s
"�z8LookupBaseFallbackTests.test_adapter_hook_w_invalid_namecCs2t�t�}}|��}|�||d�}|�|�dSr�)rZr`rUr�)rrVrWr!r+r
r
r�!test_adapter_hook_miss_no_defaultAsz9LookupBaseFallbackTests.test_adapter_hook_miss_no_defaultcCs>t�t�t�}}}|��}|�||d|�}|�||�dSr�)rZr`rUri)rrVrWr1r!r+r
r
r� test_adapter_hook_miss_w_defaultGsz8LookupBaseFallbackTests.test_adapter_hook_miss_w_defaultcslg��fdd���fdd�}t�t�t�}}}|j|d�}|�||d|�}|�||�|��|g�dS)Nc���|�dSrr%��context��_f_called_withr
r�_factoryOr#zTLookupBaseFallbackTests.test_adapter_hook_hit_factory_returns_None.<locals>._factoryc��Srr
r	�r`r
rrRrHzSLookupBaseFallbackTests.test_adapter_hook_hit_factory_returns_None.<locals>._lookuprr(�rZr`rUrirq�rrrVrWr1r!�adaptedr
�r_r`r�*test_adapter_hook_hit_factory_returns_NoneMszBLookupBaseFallbackTests.test_adapter_hook_hit_factory_returns_Nonecstg�t����fdd���fdd�}t�t�t�}}}|j|d�}|�||d|�}|�|��|��|g�dS)Nc���|��Srr%r\��_adapterr_r
rr`]�
zWLookupBaseFallbackTests.test_adapter_hook_hit_factory_returns_adapter.<locals>._factorycrarr
r	rbr
rr`rHzVLookupBaseFallbackTests.test_adapter_hook_hit_factory_returns_adapter.<locals>._lookuprr(rcrdr
�rjr_r`r�-test_adapter_hook_hit_factory_returns_adapterZ�zELookupBaseFallbackTests.test_adapter_hook_hit_factory_returns_adaptercsdg��fdd��d�fdd�	}tt|�}t�}|j|d�}|�||�}|�||�|��|g�dS)Ncs��|�|Srr%r\r^r
rr`jrkzILookupBaseFallbackTests.test_adapter_hook_super_unwraps.<locals>._factoryr�crarr
r	rbr
rrmrHzHLookupBaseFallbackTests.test_adapter_hook_super_unwraps.<locals>._lookupr)r�)�superrrZr`rUrirq)rrr
rQr!re��	__class__rfr�test_adapter_hook_super_unwrapshs
z7LookupBaseFallbackTests.test_adapter_hook_super_unwrapscstg�t����fdd���fdd�}t�t�t�}}}|j|d�}|�||d|�}|�|��|��|g�dS)Ncrhrr%r\rir
rr`yrkz;LookupBaseFallbackTests.test_queryAdapter.<locals>._factorycrarr
r	rbr
rr|rHz:LookupBaseFallbackTests.test_queryAdapter.<locals>._lookuprr()rZr`�queryAdapterrirqrdr
rlr�test_queryAdaptervrnz)LookupBaseFallbackTests.test_queryAdapterc�\g�t�t�t�g���fdd�}|j|d�}|�dd�}|�|t���|��dg�dS)Nc���||f�t��Sr�r;rWrr8r
r�
_lookupAll��zCLookupBaseFallbackTests.test_lookupAll_uncached.<locals>._lookupAll�rrr�rr�rZr`�	lookupAllrqrW�rrxr!r+r
r8r�test_lookupAll_uncached��z/LookupBaseFallbackTests.test_lookupAll_uncachedc�hg�t�t�t�g���fdd�}|j|d�}|�dd�}|�dd�}|�|t���|��dg�dS)Ncrvrrwrr8r
rrx�ryzALookupBaseFallbackTests.test_lookupAll_cached.<locals>._lookupAllrzrrr{r|r~r
r8r�test_lookupAll_cached��z-LookupBaseFallbackTests.test_lookupAll_cachedcru)Ncrvrrwrr8r
r�_subscriptions�ryzKLookupBaseFallbackTests.test_subscriptions_uncached.<locals>._subscriptions�rrrr{�rZr`�
subscriptionsrqrW�rr�r!r+r
r8r�test_subscriptions_uncached�r�z3LookupBaseFallbackTests.test_subscriptions_uncachedcr�)Ncrvrrwrr8r
rr��ryzILookupBaseFallbackTests.test_subscriptions_cached.<locals>._subscriptionsr�rrr{r�r�r
r8r�test_subscriptions_cached�r�z1LookupBaseFallbackTests.test_subscriptions_cached�NNN)!rrr	rr^r`r"r,r2r?rBrGrHrJrMrNrPrQrRrSrTrXrYrZrgrmrrrtrr�r�r��
__classcell__r
r
rprrjs@
�






rc@�eZdZdd�ZdS)�LookupBaseTestscCr?)Nr)�
LookupBase)rCr�)rr�r
r
rr^�rEzLookupBaseTests._getTargetClassN�rrr	r^r
r
r
rr���r�c@s^eZdZdd�ZeZ		ddd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�ZdS)�VerifyingBaseFallbackTestscCr?)Nr)�VerifyingBaseFallback)rCr�)rr�r
r
rr�rEz,VerifyingBaseFallbackTests._getFallbackClassNcsd�durdd���durdd���durdd��G����fdd�d|�����|�}|�|�|S)	NcSrrr
r	r
r
rr�rz6VerifyingBaseFallbackTests._makeOne.<locals>.uc_lookupcSrrr
rr
r
rr�rz9VerifyingBaseFallbackTests._makeOne.<locals>.uc_lookupAllcSrrr
rr
r
rr�rz=VerifyingBaseFallbackTests._makeOne.<locals>.uc_subscriptionscs*eZdZ�Z�Z�Z��fdd�Z�ZS)z4VerifyingBaseFallbackTests._makeOne.<locals>.Derivedcst�|���||_dSr)ror6�	_registryrs)rrqr
rr6�s
z=VerifyingBaseFallbackTests._makeOne.<locals>.Derived.__init__)rrr	rrrr6r�r
�rrrrrprr�s
r)r^rM)rrmrrr�derivedr
r�rr`�s
z#VerifyingBaseFallbackTests._makeOnecs*Gdd�dt��G�fdd�d�}||�S)Nc@seZdZdZdS)z@VerifyingBaseFallbackTests._makeRegistry.<locals>.WithGenerationrpN)rrr	rrr
r
r
r�WithGeneration�sr�cseZdZ�fdd�ZdS)z:VerifyingBaseFallbackTests._makeRegistry.<locals>.Registrycs�fdd�t|�D�|_dS)Ncsg|]}���qSr
r
)rS�i�r�r
rrV�szWVerifyingBaseFallbackTests._makeRegistry.<locals>.Registry.__init__.<locals>.<listcomp>)�range�ro)r�depthr�r
rr6�szCVerifyingBaseFallbackTests._makeRegistry.<locals>.Registry.__init__Nr7r
r�r
r�Registry�sr�)rZ)rr�r�r
r�r�
_makeRegistry�sz(VerifyingBaseFallbackTests._makeRegistryc��g�t�t�t�}}}|||g���fdd�}|�d�}|j||d�}|�ddd�}|�ddd�}|�||�|��dg�|��||g�|jd	jd	7_|�ddd�}|�||�|��ddg�|��|g�dS)
Ncr5r�r6r	r8r
rr�r:z7VerifyingBaseFallbackTests.test_lookup.<locals>._lookupr�rrrr(r)rp)rZr�r`rrirqr�rr�rr<r=r>rrGr!r+r
r8r�test_lookup��$

�z&VerifyingBaseFallbackTests.test_lookupcr�)
Ncr5r�r6r	r8r
rr�r:z8VerifyingBaseFallbackTests.test_lookup1.<locals>._lookupr�rrrr(r)rp)rZr�r`rLrirqr�rrr�r
r8r�test_lookup1�r�z'VerifyingBaseFallbackTests.test_lookup1cs�t�t�t�g\��}�fdd�}�fdd�}�fdd�}|||g��fdd�}t�t�t�}}}��d	�}	�j|	|d
�}
|
�||d|�}��|��|
�||d|�}��|��|	jdjd7_|
�||d|�}��|��dS)
Ncrarr
r\�r<r
r�	_factory1rHz?VerifyingBaseFallbackTests.test_adapter_hook.<locals>._factory1crarr
r\�r=r
r�	_factory2rHz?VerifyingBaseFallbackTests.test_adapter_hook.<locals>._factory2c���d�dSrr�r\r(r
r�	_factory3r#z?VerifyingBaseFallbackTests.test_adapter_hook.<locals>._factory3c�
��d�Sr��r7r	��
_factoriesr
rrr z=VerifyingBaseFallbackTests.test_adapter_hook.<locals>._lookupr�rr(rp)rZr�r`rUrir�rr�r�_cr�r�r�rrVrWr1rGr!rer
�r�r<r=rr�test_adapter_hook� 

z,VerifyingBaseFallbackTests.test_adapter_hookcs�t�t�t�g\��}�fdd�}�fdd�}�fdd�}|||g��fdd�}t�t�t�}}}��d	�}	�j|	|d
�}
|
�||d|�}��|��|
�||d|�}��|��|	jdjd7_|
�||d|�}��|��dS)
Ncrarr
r\r�r
rr�$rHz?VerifyingBaseFallbackTests.test_queryAdapter.<locals>._factory1crarr
r\r�r
rr�&rHz?VerifyingBaseFallbackTests.test_queryAdapter.<locals>._factory2cr�rr�r\r(r
rr�(r#z?VerifyingBaseFallbackTests.test_queryAdapter.<locals>._factory3cr�r�r�r	r�r
rr+r z=VerifyingBaseFallbackTests.test_queryAdapter.<locals>._lookupr�rr(rp)rZr�r`rsrir�rrrUr�r
r�rrt"r�z,VerifyingBaseFallbackTests.test_queryAdapterc�t�t�t�g}t�t�t�g}||g��fdd�}|�d�}|j||d�}|�dd�}|�|t|��|�dd�}|�|t|��|jdjd7_|�dd�}|�|t|��dS)Nc�t��d��Sr��rWr7r�r9r
rrx<r#z=VerifyingBaseFallbackTests.test_lookupAll.<locals>._lookupAllr�rzrrrp)rZr�r`r}rqrWr�rr)r�
_results_1�
_results_2rxrGr!r+r
r�r�test_lookupAll8�
z)VerifyingBaseFallbackTests.test_lookupAllcr�)Ncr�r�r�rr�r
rr�Lr#zEVerifyingBaseFallbackTests.test_subscriptions.<locals>._subscriptionsr�r�rrrp)rZr�r`r�rqrWr�rr)rr�r�r�rGr!r+r
r�r�test_subscriptionsHr�z-VerifyingBaseFallbackTests.test_subscriptionsr�)
rrr	rr^r`r�r�r�r�rtr�r�r
r
r
rr��s
�r�c@r�)�VerifyingBaseTestscCr?)Nr)�
VerifyingBase)rCr�)rr�r
r
rr^\rEz"VerifyingBaseTests._getTargetClassNr�r
r
r
rr�Yr�r�cs<eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Z�fd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�Zd7d8�Zd9d:�Zd;d<�Z d=d>�Z!d?d@�Z"dAdB�Z#dCdD�Z$dEdF�Z%dGdH�Z&dIdJ�Z'�Z(S)K�AdapterLookupBaseTestscCr?)Nr)�AdapterLookupBase)rCr�)rr�r
r
rr^crEz&AdapterLookupBaseTests._getTargetClasscCs|��|�Srr_rsr
r
rr`gr%zAdapterLookupBaseTests._makeOnecGsGdd�d�}|�S)Nc@r�)z<AdapterLookupBaseTests._makeSubregistry.<locals>.SubregistrycSsg|_g|_dSr)r|r�r(r
r
rr6l�
zEAdapterLookupBaseTests._makeSubregistry.<locals>.Subregistry.__init__Nr7r
r
r
r�Subregistryk�r�r
)rrQr�r
r
r�_makeSubregistryjsz'AdapterLookupBaseTests._makeSubregistrycGsGdd�d�}||�S)Nc@r�)z6AdapterLookupBaseTests._makeRegistry.<locals>.RegistrycSs||_g|_dSr)r�r�rPr
r
rr6sr�z?AdapterLookupBaseTests._makeRegistry.<locals>.Registry.__init__Nr7r
r
r
rr�rr�r�r
)rrQr�r
r
rr�qsz$AdapterLookupBaseTests._makeRegistrycCs$|��}|�|�}|�|ji�dSr)r�r`rqrO)rrm�albr
r
r�test_ctor_empty_registryxs
z/AdapterLookupBaseTests.test_ctor_empty_registrycCs�ddlm}ddlm}|d�}|d|f�}|�||�}|�|�}|�t|j�	��t|||g��|�|j|||g�|�|j||g�|�t|j|�t||g��dS�Nrr��InterfaceClass�IFoo�IBar)
rr�zope.interface.interfacer�r�r`rqr�rO�keys�rrr�r�r�rmr�r
r
r�test_ctor_w_registry_provided}s
�
�z4AdapterLookupBaseTests.test_ctor_w_registry_providedcCsDGdd�dt�}Gdd�d|��|�}|��}||�}|�|�dS)Nc@r�)zAAdapterLookupBaseTests.test_changed_empty_required.<locals>.MixincWrFrr
r,r
r
rrM�rHzIAdapterLookupBaseTests.test_changed_empty_required.<locals>.Mixin.changedN�rrr	rMr
r
r
r�Mixin�r�r�c@r)zCAdapterLookupBaseTests.test_changed_empty_required.<locals>.DerivedNrr
r
r
rr�r
r)rZr^r�rM)rr�rrmr�r
r
r�test_changed_empty_required�s
z2AdapterLookupBaseTests.test_changed_empty_requiredcCs�Gdd�dt�}Gdd�d|��|�}Gdd�dt�}|d�}|d�}|��}||�}d	|j|<d	|j|<|�|�|�t|j�d
�|�|jd�|�|j|�dS)Nc@r�)z=AdapterLookupBaseTests.test_changed_w_required.<locals>.MixincWrFrr
r,r
r
rrM�rHzEAdapterLookupBaseTests.test_changed_w_required.<locals>.Mixin.changedNr�r
r
r
rr��r�r�c@r)z?AdapterLookupBaseTests.test_changed_w_required.<locals>.DerivedNrr
r
r
rr�r
rc@s(eZdZdZdd�Zdd�Zdd�ZdS)zCAdapterLookupBaseTests.test_changed_w_required.<locals>.FauxWeakrefNcS�
||_dSr��_here)r�herer
r
rr6�r zLAdapterLookupBaseTests.test_changed_w_required.<locals>.FauxWeakref.__init__cSs|jr|SdSrr�r(r
r
r�__call__�r#zLAdapterLookupBaseTests.test_changed_w_required.<locals>.FauxWeakref.__call__cSr�r)�_unsub)r�targetr
r
rr��r zOAdapterLookupBaseTests.test_changed_w_required.<locals>.FauxWeakref.unsubscribe)rrr	r�r6r�r�r
r
r
r�FauxWeakref�s
r�FTrpr)rZr^r��	_requiredrMrqr'r�)rr�rr��goner�rmr�r
r
r�test_changed_w_required�s


z.AdapterLookupBaseTests.test_changed_w_requiredcCs�ddlm}ddlm}|d�}|d|f�}|��}|�|�}||g|_|��|�t	|j
���t	|||g��|�|j
|||g�|�|j
||g�|�t	|j
|�t	||g��dSr�)rrr�r�r�r`r��init_extendorsrqr�rOr�r�r
r
r�)test_init_extendors_after_registry_update�s 

�
�z@AdapterLookupBaseTests.test_init_extendors_after_registry_updatecCs�ddlm}ddlm}|d�}|d|f�}|��}|�|�}|�|�|�|�|�t|j	�
��t|||g��|�|j	|||g�|�|j	||g�|�t|j	|�t||g��dSr�)rrr�r�r�r`rRrqr�rOr�r�r
r
r�test_add_extendor�s 


�
�z(AdapterLookupBaseTests.test_add_extendorcCs�ddlm}ddlm}|d�}|d|f�}|�||�}|�|�}|�|�|�t|j	�
��t|||g��|�|j	||g�|�|j	||g�|�t|j	|�t|g��dSr�)rrr�r�r�r`rXrqr�rOr�r�r
r
r�test_remove_extendor�s

��z+AdapterLookupBaseTests.test_remove_extendorcCstddlm}|d�}|d|f�}|��}|�|�}|�|f|�}|�|d�|�t|j�d�|�|�	�|j�dS�Nrr�r�r�rp)
r�r�r�r`rrqr'r�r��weakref�rr�r�r�rmr��resultr
r
r�test__uncached_lookup_empty_ro��
z5AdapterLookupBaseTests.test__uncached_lookup_empty_rocCshddlm}|d�}|d|f�}|�||�}|��}|j�|�|�|�}|�|f|�}|�|d�dS�Nrr�r�r�)	r�r�r�r�r�r;r`rrq�rr�r�r�rm�subrr�r�r
r
r� test__uncached_lookup_order_miss�s
z7AdapterLookupBaseTests.test__uncached_lookup_order_misscCstddlm}|d�}|d|f�}|��}|��}iig|_|j�|�|�|�}||_|�	|f|�}|�
|d�dSr�)r�r�r�r�r|r�r;r`rkrrqr�r
r
r�$test__uncached_lookup_extendors_miss��

z;AdapterLookupBaseTests.test__uncached_lookup_extendors_missc
Cs�ddlm}|d�}|d|f�}|d�}|�||�}|��}t�}i||d|iiig|_|j�|�|�|�}||_	|�
|f|�}	|�|	d�dS�Nrr�r�r��IQuxr��r�r�r�r�rZr|r�r;r`rkrrq�
rr�r�r�r�rmr��
irrelevantr�r�r
r
r�1test__uncached_lookup_components_miss_wrong_ifaces�
zHAdapterLookupBaseTests.test__uncached_lookup_components_miss_wrong_ifacec	Cs�ddlm}|d�}|d|f�}|�||�}|��}t�}i||d|iiig|_|j�|�|�|�}||_	|�
|f|�}|�|d�dS�Nrr�r�r��	wrongnamer��	rr�r�r�rmr�r�r�r�r
r
r�0test__uncached_lookup_components_miss_wrong_names�
zGAdapterLookupBaseTests.test__uncached_lookup_components_miss_wrong_namec	Cs�ddlm}|d�}|d|f�}|�||�}|��}t�}i||d|iiig|_|j�|�|�|�}||_	|�
|f|�}|�||�dS�Nrr�r�r�r��r�r�r�r�rZr|r�r;r`rkrri)	rr�r�r�rmr��	_expectedr�r�r
r
r� test__uncached_lookup_simple_hit*��
z7AdapterLookupBaseTests.test__uncached_lookup_simple_hitc
Cs�ddlm}|d�}|d|f�}|�||�}|��}t�}i||d|iiig|_|j�|�|�|�}||_	|�
|f|�}|�
|f|�}	|�||�|�|	|�dSr�r�)
rr�r�r�rmr�r�r�r��result2r
r
r�"test__uncached_lookup_repeated_hit;s �
z9AdapterLookupBaseTests.test__uncached_lookup_repeated_hitcCs�ddlm}ddlm}|d�}|d|f�}||�Gdd�dt��}|�}|��}|��}iig|_|j�	|�|�
|�}	|	j|	_|	|_
t�}
|	j|f||
d�}|�||
�dS)	Nr��implementerr�r�r�c@r)zFAdapterLookupBaseTests.test_queryMultiAdaptor_lookup_miss.<locals>.FooNrr
r
r
r�FooS�r��default)�zope.interface.declarationsr�r�r�rZr�r�r|r�r;r`rrrk�queryMultiAdapterri)rr�r�r�r�r�foormr�r�r1r�r
r
r�"test_queryMultiAdaptor_lookup_missNs&�
z9AdapterLookupBaseTests.test_queryMultiAdaptor_lookup_misscslddlm}ddlm}|d��|��}|�|���j�_��fdd�}tt	u}|j
|||r0dndd	�dS)
Nrr�)�MissingSomeAttrsr�cs��|f��Sr)r)�ob�r�r�r
r�testrs�zVAdapterLookupBaseTests.test_queryMultiAdapter_errors_on_attribute_access.<locals>.testrq�__providedBy__)�expected_missing)r�r��zope.interface.testsrr�r`rr�str�bytes�test_raises)rr�rrmr�PY3r
r
r�1test_queryMultiAdapter_errors_on_attribute_accesses


�zHAdapterLookupBaseTests.test_queryMultiAdapter_errors_on_attribute_accesscs�ddlm}ddlm}|d�}|d|f�}||�Gdd�dt��}|�}|�||�}|��}t�}	g��fdd	�}
i||d
|
iiig|_|j�	|�|�
|�}|j|_||_
t�}|j|f||d�}
|�|
|�|��|g�dS)Nrr�r�r�r�c@r)zGAdapterLookupBaseTests.test_queryMultiAdaptor_factory_miss.<locals>.FooNrr
r
r
rr�rrcr[rr%r\r&r
rr`�r#zLAdapterLookupBaseTests.test_queryMultiAdaptor_factory_miss.<locals>._factoryr�r�rr�r�r�rZr�r�r|r�r;r`rrrkrrirq)rr�r�r�r�rrrmr�r�r`r�r1r�r
r&r�#test_queryMultiAdaptor_factory_miss|s.�
z:AdapterLookupBaseTests.test_queryMultiAdaptor_factory_missc
s�ddlm}ddlm}|d�}|d|f�}||�Gdd�dt��}|�}|�||�}|��}t��g���fdd	�}	i||d
|	iiig|_|j�	|�|�
|�}
|
j|
_|
|_
t�}|
j|f||d�}|�|��|��|g�dS)Nrr�r�r�r�c@r)zFAdapterLookupBaseTests.test_queryMultiAdaptor_factory_hit.<locals>.FooNrr
r
r
rr�rrcs��|��Srr%r\�r'r�r
rr`�rkzKAdapterLookupBaseTests.test_queryMultiAdaptor_factory_hit.<locals>._factoryr�rr)
rr�r�r�r�rrrmr�r`r�r1r�r
rr�"test_queryMultiAdaptor_factory_hit�s.�
z9AdapterLookupBaseTests.test_queryMultiAdaptor_factory_hitcsd|�|���}�fdd�}dd��||_tt|�ddtt|�g}|�|d�}|�||dd|f�dS)Ncrarr
�r���factoryr
rr�rHzKAdapterLookupBaseTests.test_queryMultiAdapter_super_unwraps.<locals>.lookupcWs|Srr
rr
r
rr�rHzLAdapterLookupBaseTests.test_queryMultiAdapter_super_unwraps.<locals>.factory�*�abc)r`r�rror�rrq)rr�r�objectsr�rprr�$test_queryMultiAdapter_super_unwraps�s �
�z;AdapterLookupBaseTests.test_queryMultiAdapter_super_unwrapscCstddlm}|d�}|d|f�}|��}|�|�}|�|f|�}|�|d�|�t|j�d�|�|�	�|j�dS)Nrr�r�r�r
rp)
r�r�r�r`rrqr'r�r�r�r�r
r
r�!test__uncached_lookupAll_empty_ro�r�z8AdapterLookupBaseTests.test__uncached_lookupAll_empty_rocCsnddlm}|d�}|d|f�}|�||�}|��}|j�|�|�|�}||_|�|f|�}|�	|d�dS�Nrr�r�r�r
)
r�r�r�r�r�r;r`rkrrqr�r
r
r�#test__uncached_lookupAll_order_miss��
z:AdapterLookupBaseTests.test__uncached_lookupAll_order_misscCstddlm}|d�}|d|f�}|��}|��}iig|_|j�|�|�|�}||_|�	|f|�}|�
|d�dSr )r�r�r�r�r|r�r;r`rkrrqr�r
r
r�'test__uncached_lookupAll_extendors_miss�r�z>AdapterLookupBaseTests.test__uncached_lookupAll_extendors_missc
Cs�ddlm}|d�}|d|f�}|d�}|�||�}|��}t�}i||d|iiig|_|j�|�|�|�}||_	|�
|f|�}	|�|	d�dS)Nrr�r�r�r�r�r
)r�r�r�r�rZr|r�r;r`rkrrqr�r
r
r�(test__uncached_lookupAll_components_miss���
z?AdapterLookupBaseTests.test__uncached_lookupAll_components_missc
Cs�ddlm}|d�}|d|f�}|�||�}|��}t�}t�}i||||d�iig|_|j�|�|�|�}||_	|�
|f|�}	|�t|	�d|fd|fg�dS�Nrr�r�r�)r��namedr�r')
r�r�r�r�rZr|r�r;r`rkrrqr��
rr�r�r�rmr�r��_namedr�r�r
r
r�#test__uncached_lookupAll_simple_hits�
 z:AdapterLookupBaseTests.test__uncached_lookupAll_simple_hitc
Cs�ddlm}|d�}|d|f�}|�||�}|��}t�}t�}i||||d�iig|_|j�|�|�|�}|j	|_
||_|�|f|�}	|�
t|	�ddg�dSr&)r�r�r�r�rZr|r�r;r`rr}rk�namesrqr�r(r
r
r�
test_namess �
z!AdapterLookupBaseTests.test_namescCstddlm}|d�}|d|f�}|��}|�|�}|�|f|�}|�|g�|�t|j�d�|�|�	�|j�dSr�)
r�r�r�r`rrqr'r�r�r�r�r
r
r�%test__uncached_subscriptions_empty_ro(r�z<AdapterLookupBaseTests.test__uncached_subscriptions_empty_rocCsnddlm}|d�}|d|f�}|�||�}|��}|j�|�|�|�}||_|�|f|�}|�	|g�dSr�)
r�r�r�r�r�r;r`rkrrqr�r
r
r�'test__uncached_subscriptions_order_miss3r"z>AdapterLookupBaseTests.test__uncached_subscriptions_order_misscCstddlm}|d�}|d|f�}|��}|��}iig|_|j�|�|�|�}||_|�	|f|�}|�
|g�dSr�)r�r�r�r�r�r�r;r`rkrrqr�r
r
r�+test__uncached_subscriptions_extendors_miss?r�zBAdapterLookupBaseTests.test__uncached_subscriptions_extendors_missc
Cs�ddlm}|d�}|d|f�}|d�}|�||�}|��}t�}i||d|iiig|_|j�|�|�|�}||_	|�
|f|�}	|�|	g�dSr��r�r�r�r�rZr�r�r;r`rkrrqr�r
r
r�8test__uncached_subscriptions_components_miss_wrong_ifaceLr%zOAdapterLookupBaseTests.test__uncached_subscriptions_components_miss_wrong_ifacec	Cs�ddlm}|d�}|d|f�}|�||�}|��}t�}i||d|iiig|_|j�|�|�|�}||_	|�
|f|�}|�|g�dSr�r0r�r
r
r�7test__uncached_subscriptions_components_miss_wrong_name^r�zNAdapterLookupBaseTests.test__uncached_subscriptions_components_miss_wrong_namecCs�ddlm}|d�}|d|f�}|�||�}|��}Gdd�dt�}|�|�}}i||d||fiiig|_|j�|�|�|�}	|	|_	|	�
|f|�}
|�t|
�t||g��dS)Nrr�r�r�c@r�)zKAdapterLookupBaseTests.test__uncached_subscriptions_simple_hit.<locals>.FoocSsdS)NTr
r,r
r
r�__lt__vrHzRAdapterLookupBaseTests.test__uncached_subscriptions_simple_hit.<locals>.Foo.__lt__N)rrr	r3r
r
r
rrur�rr�)
r�r�r�r�rZr�r�r;r`rkrrqr�)rr�r�r�rmr�r�_exp1�_exp2r�r�r
r
r�'test__uncached_subscriptions_simple_hitos�
z>AdapterLookupBaseTests.test__uncached_subscriptions_simple_hitc
s�ddlm}ddlm}|d�}|d|f�}||�Gdd�dt��}|�}|�||�}|�||�}|��}i��fdd	�}	�fd
d�}
i|dd|	|
fiiig|_|j�	|�|�
|�}|j|_||_
|�|fd�}|�|d
�|��|g|gd��dS)Nrr�r�r�r�c@r)z@AdapterLookupBaseTests.test_subscribers_wo_provided.<locals>.FooNrr
r
r
rr�rrc���dg��|�dS�Nr���
setdefaultr;r\��_calledr
rr���zFAdapterLookupBaseTests.test_subscribers_wo_provided.<locals>._factory1cr7�Nr�r9r\r;r
rr��r=zFAdapterLookupBaseTests.test_subscribers_wo_provided.<locals>._factory2r�r
)r�r��rr�r�r�rZr�r�r�r�r;r`rr�rk�subscribersrq)
rr�r�r�r�rrrmr�r�r�r�r�r
r;r�test_subscribers_wo_provided�s.�
z3AdapterLookupBaseTests.test_subscribers_wo_providedcs ddlm}ddlm}|d�}|d|f�}||�Gdd�dt��}|�}|�||�}|�||�}|��}i�t�t�����fdd	�}	��fd
d�}
�fdd
�}i||d|	|
|fiiig|_|j�	|�|�
|�}|j|_||_
|�|f|�}
|�|
��g�|��|g|g|gd��dS)Nrr�r�r�r�c@r)z?AdapterLookupBaseTests.test_subscribers_w_provided.<locals>.FooNrr
r
r
rr�rrc���dg��|��Sr8r9r\)r<r4r
rr���zEAdapterLookupBaseTests.test_subscribers_w_provided.<locals>._factory1crBr>r9r\)r<r5r
rr��rCzEAdapterLookupBaseTests.test_subscribers_w_provided.<locals>._factory2cr7)N�_side_effect_onlyr9r\r;r
rrD�r=zMAdapterLookupBaseTests.test_subscribers_w_provided.<locals>._side_effect_onlyr�)r�r�rDr?)rr�r�r�r�rrrmr�r�r�rDr�r�r
)r<r4r5r�test_subscribers_w_provided�s<�
��z2AdapterLookupBaseTests.test_subscribers_w_provided))rrr	r^r`r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrrrr!r#r$r*r,r-r.r/r1r2r6rArEr�r
r
rprr�asL


r�c@s$eZdZdd�Zdd�Zdd�ZdS)�VerifyingAdapterRegistryTestscCr?)Nr)�VerifyingAdapterRegistry)rCrG)rrGr
r
rr^�rEz-VerifyingAdapterRegistryTests._getTargetClasscOs|��|i|��Srr_)rr��kwr
r
rr`�sz&VerifyingAdapterRegistryTests._makeOnecCs.ddlm}ddlm}|��}|||�dS)Nr)�verifyObject)�IAdapterRegistry)�zope.interface.verifyrI�zope.interface.interfacesrJr`)rrIrJrmr
r
r�,test_verify_object_provides_IAdapterRegistry�szJVerifyingAdapterRegistryTests.test_verify_object_provides_IAdapterRegistryN)rrr	r^r`rMr
r
r
rrF�srFc@sDeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dS)�AdapterRegistryTestscCr?)Nr)�AdapterRegistry)rCrO)rrOr
r
rr^�rEz$AdapterRegistryTests._getTargetClasscCs|��}|�t|j�d�dSr�)r`rqr'�_v_subregistries)r�arr
r
r�test_ctor_no_bases�sz'AdapterRegistryTests.test_ctor_no_basescCsJ|��}|�|g�}|�t|j�d�|�t|j�d�|�||j�dSr{)r`rqr'rPr�)r�base�subr
r
r�test_ctor_w_bases�s
z&AdapterRegistryTests.test_ctor_w_basescCsZ|��}|��}|�|g�}|g|_|�t|j�d�|�t|j�d�|�||j�dSr{�r`ryrqr'rPr��r�before�afterrTr
r
r�,test__setBases_removing_existing_subregistry�szAAdapterRegistryTests.test__setBases_removing_existing_subregistrycCsr|��}|��}|��}|�|g�}|jd�|�|g|_|�t|j�d�|�t|j�d�|�||j�dS)Nryrrp)r`�__dict__r;ryrqr'rPr�)rrX�strayrYrTr
r
r�test__setBases_wo_stray_entry�sz2AdapterRegistryTests.test__setBases_wo_stray_entrycCsj|��}|��}|�|g�}||g|_|�t|j�d�|�t|j�d�|�||j�|�||j�dSrorVrWr
r
r�*test__setBases_w_existing_entry_continuings
z?AdapterRegistryTests.test__setBases_w_existing_entry_continuingcCsj|��}Gdd�dt�}|�|�}}|�|�|�|�t�}|�|�|�|j|�|�|j|�dS)Nc@seZdZdZdd�ZdS)zBAdapterRegistryTests.test_changed_w_subregistries.<locals>.DerivedNcSr�rrJ)r�originally_changedr
r
rrMr zJAdapterRegistryTests.test_changed_w_subregistries.<locals>.Derived.changed)rrr	rKrMr
r
r
rrsr)r`rZ�_addSubregistryrMrirK)rrSr�derived1�derived2rLr
r
r�test_changed_w_subregistriess


z1AdapterRegistryTests.test_changed_w_subregistriesN)
rrr	r^rRrUrZr]r^rcr
r
r
rrN�s		
rNc@s4eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)�
Test_utilscCs,ddlm}ddlm}|�|d�|�dS)Nr��_convert_None_to_Interfacer)rCrfr�rri)rrfrr
r
r�&test__convert_None_to_Interface_w_Nonesz1Test_utils.test__convert_None_to_Interface_w_NonecCs&ddlm}t�}|�||�|�dS)Nrre)rCrfrZri)rrfr-r
r
r�'test__convert_None_to_Interface_w_other$sz2Test_utils.test__convert_None_to_Interface_w_othercCs<ddlm}d}d}||�}|�||�|�|t|��dS)Nr��_normalize_namesstrr)rCrjrqr}r+)rrj�STR�UNICODE�normr
r
r�test__normalize_name_str)sz#Test_utils.test__normalize_name_strcCs$ddlm}d}|�||�|�dS)Nrri�ustr)rCrjrq)rrj�USTRr
r
r�test__normalize_name_unicode1sz'Test_utils.test__normalize_name_unicodecCs6ddlm}dddgit�fD]	}|�t||�qdS)Nrrirpg�?r
)rCrjrZr��	TypeError)rrjr-r
r
r�test__normalize_name_other7s�z%Test_utils.test__normalize_name_otherN)rrr	rgrhrnrqrsr
r
r
rrdsrd)r�unittestrrrrZrr2r9r<r=�TestCaser>r�rr�r�r�r�rFrNrdr
r
r
r�<module>sF
	U2K��k@

Anon7 - 2022
AnonSec Team