Your IP : 216.73.216.172


Current Path : /lib/python3/dist-packages/zope/component/tests/__pycache__/
Upload File :
Current File : //lib/python3/dist-packages/zope/component/tests/__pycache__/test_persistentregistry.cpython-38.pyc

U

,�Wg�@sDdZddlZGdd�dej�ZGdd�dej�Zdd�Zd	d
�ZdS)zTests for z.c.hooks
�Nc@sfeZdZdd�Zdd�Zdd�Zdd�Zdd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dS)�PersistentAdapterRegistryTestscCsddlm}|S)Nr��PersistentAdapterRegistry)�!zope.component.persistentregistryr)�selfr�r�N/usr/lib/python3/dist-packages/zope/component/tests/test_persistentregistry.py�_getTargetClasssz.PersistentAdapterRegistryTests._getTargetClasscOs|��||�S�N�r	�r�args�kwrrr�_makeOnesz'PersistentAdapterRegistryTests._makeOnecCsGdd�dt�}||�S)Nc@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
z9PersistentAdapterRegistryTests._makeCache.<locals>._CachecSs||_g|_dSr
)�_jar�_mru)r�jarrrr�__init__ szBPersistentAdapterRegistryTests._makeCache.<locals>._Cache.__init__cSs|j�|�dSr
)r�append)r�oidrrr�mru#sz=PersistentAdapterRegistryTests._makeCache.<locals>._Cache.mrucSs|j|_||_dSr
)rZ_p_jar�_p_oid)rr�objrrr�	new_ghost%szCPersistentAdapterRegistryTests._makeCache.<locals>._Cache.new_ghostcSsdSr
r)rr�sizerrr�update_object_size_estimation(szWPersistentAdapterRegistryTests._makeCache.<locals>._Cache.update_object_size_estimationN)�__name__�
__module__�__qualname__rrrrrrrr�_Cachesr)�object)rrrrrr�
_makeCachesz)PersistentAdapterRegistryTests._makeCachecCsFddlm}ddlm}||�Gdd�dt��}|�}|�|�|_|S)Nr)�implementer)�IPersistentDataManagerc@s$eZdZdd�Zdd�Zdd�ZdS)z5PersistentAdapterRegistryTests._makeJar.<locals>._JarcSsg|_g|_dSr
)�_loaded�_registered)rrrrr4sz>PersistentAdapterRegistryTests._makeJar.<locals>._Jar.__init__cSs|j�|j�dSr
)r$rr�rrrrr�setstate7sz>PersistentAdapterRegistryTests._makeJar.<locals>._Jar.setstatecSs|j�|j�dSr
)r%rrr&rrr�register9sz>PersistentAdapterRegistryTests._makeJar.<locals>._Jar.registerN)rrrrr'r(rrrr�_Jar2sr))Zzope.interfacer"Zpersistent.interfacesr#r r!�_cache)rr"r#r)rrrr�_makeJar-s	z'PersistentAdapterRegistryTests._makeJarFcKs4td�}|jf|�}|��}|j�||�|||fS)Nz)�_makeOctetsrr+r*r)rZdirtyr�OID�instrrrr�_makeOneWithJar@s
z.PersistentAdapterRegistryTests._makeOneWithJarcCsH|��\}}}|�|jd�|�t��|�|jd�|�|jd�dS�N�T�)r/�assertEqual�_generation�changedr �
_p_changed�r�registryrr-rrr�test_changed_original_is_not_usHs
z>PersistentAdapterRegistryTests.test_changed_original_is_not_uscCsF|��\}}}|�|jd�|�|�|�|jd�|�|jd�dSr0)r/r3r4r5r6r7rrr�test_changed_original_is_usRs

z:PersistentAdapterRegistryTests.test_changed_original_is_uscCs�ddlm}|j|jf}|j|d�\}}}|��}|�|d|�|�|dd�|�|di�|�|dg�|�|d	g�|�d
|k�dS)Nr��globalSiteManager��bases�	__bases__r4r1Z	_providedZ	_adaptersZ_subscribers�ro)�zope.componentr<�adapters�	utilitiesr/�__getstate__r3�assertFalse�rr<r>r8rr-�staterrr�test___getstate___simple[sz7PersistentAdapterRegistryTests.test___getstate___simplecCs.|��\}}}dd�|_|�d|��k�dS)NcWs
dddgS)N�a�b�cr)r
rrr�<lambda>i�zXPersistentAdapterRegistryTests.test___getstate___skips_delegated_names.<locals>.<lambda>�names)r/rNrErDr7rrr�'test___getstate___skips_delegated_namesgs
zFPersistentAdapterRegistryTests.test___getstate___skips_delegated_namescCsZ|��\}}}|��}|�d|jk�d|_|�d|jk�|�|�|�d|jk�dS)NZ	_v_lookup)r/rD�
assertTrue�__dict__r6rE�__setstate__)rr8rr-rGrrr�$test___setstate___rebuilds__v_lookupls
zCPersistentAdapterRegistryTests.test___setstate___rebuilds__v_lookupcCsfddlm}|j|jf}|j|d�\}}}|��}|�|�|�|j|�|�|j	|gt
|��dS)Nrr;r=)rAr<rBrCr/rDrRr3r?r@�listrFrrr�test___setstate___rebuilds__rous
z=PersistentAdapterRegistryTests.test___setstate___rebuilds__roN)F)rrrr	rr!r+r/r9r:rHrOrSrUrrrrrs

		rc@s$eZdZdd�Zdd�Zdd�ZdS)�PersistentComponentsTestscCsddlm}|S)Nr)�PersistentComponents)rrW)rrWrrrr	�sz)PersistentComponentsTests._getTargetClasscOs|��||�Sr
rrrrrr�sz"PersistentComponentsTests._makeOnecCs�ddlm}ddlm}ddlm}|��}|�t|j	|��|�t|j
|��|�t|j|��|�t|j|��|�t|j
|��|�t|j|��dS)Nr)�PersistentMapping)�PersistentListr)Zpersistent.mappingrXZpersistent.listrYrrrrP�
isinstancerBrCZ_adapter_registrationsZ_utility_registrationsZ_subscription_registrationsZ_handler_registrations)rrXrYrr8rrr�2test_ctor_initializes_registries_and_registrations�s,
�
�
�
�
�
�zLPersistentComponentsTests.test_ctor_initializes_registries_and_registrationsN)rrrr	rr[rrrrrVsrVcCs$ddl}|jdkrt|�St|d�S)Nr)��ascii)�sys�version_info�bytes)�sr^rrrr,�s
r,cCst�t�t�t�t�f�Sr
)�unittestZ	TestSuiteZ	makeSuiterrVrrrr�
test_suite�s�rc)�__doc__rbZTestCaserrVr,rcrrrr�<module>s
l