CasperSecurity

Current Path : /lib/python3/dist-packages/twisted/python/test/__pycache__/
Upload File :
Current File : //lib/python3/dist-packages/twisted/python/test/__pycache__/test_components.cpython-310.pyc

o

�b�d�@sdZddlmZddlmZmZmZddlmZddl	m
Z
ddlmZm
Z
ddlmZmZmZddlmZGd	d
�d
e
j�ZGdd�de�ZGd
d�de�Zee�Gdd�de
j��Zee�Gdd�de
j��ZGdd�de
j�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�Z Gdd �d e�Z!eee e!�Gd!d"�d"e
j��Z"ee�Gd#d$�d$��Z#Gd%d&�d&�Z$Gd'd(�d(ej%e$�Z&Gd)d*�d*ej%�Z'Gd+d,�d,e�Z(ee(�Gd-d.�d.e
j��Z)ee(�Gd/d0�d0e
j��Z*Gd1d2�d2�Z+Gd3d4�d4e
j�Z,ee(�Gd5d6�d6e
j��Z-Gd7d8�d8e�Z.Gd9d:�d:e�Z/ee.�Gd;d<�d<��Z0e
Gd=d>�d>��Z1Gd?d@�d@e$ej%�Z2GdAdB�dBe$ej%�Z3GdCdD�dDe�Z4GdEdF�dFe4�Z5ee4�GdGdH�dH��Z6ee5�GdIdJ�dJ��Z7GdKdL�dLe�Z8GdMdN�dN�Z9GdOdP�dPej%�Z:dQS)Rz0
Test cases for Twisted component architecture.
�)�wraps)�	Attribute�	Interface�implementer)�AdapterRegistry)�
components)�cmp�
comparable)�_addHook�_removeHook�proxyForInterface)�unittestc@�eZdZdZdd�ZdS)�ComporcCs|jd|_|jS�N���num��self�r�E/usr/lib/python3/dist-packages/twisted/python/test/test_components.py�incsz	Compo.incN)�__name__�
__module__�__qualname__rrrrrrr�rc@�eZdZdd�ZdS)�IAdeptcCst���N)�NotImplementedErrorrrrr�adaptorFuncszIAdept.adaptorFuncN)rrrr!rrrrr�rc@r)�IElapsedcC�dS)z
        1!
        Nrrrrr�elapsedFunc#�zIElapsed.elapsedFuncN�rrrr%rrrrr#"r"r#c@seZdZdd�Zdd�ZdS)�AdeptcCs||_d|_dS�Nr��originalr�r�origrrr�__init__+�
zAdept.__init__cCs|jd|_|j|j��fSr)rr+rrrrrr!/szAdept.adaptorFuncN)rrrr.r!rrrrr()sr(c@r)�ElapsedcCr$rrrrrrr%6�zElapsed.elapsedFuncNr'rrrrr04�r0c@�eZdZdS)�ACompN�rrrrrrrr4:�r4c@r3)�BCompNr5rrrrr7>r6r7c@r3)�CCompNr5rrrrr8Br6r8c@r3)�ITestNr5rrrrr9Fr6r9c@r3)�ITest2Nr5rrrrr:Jr6r:c@r3)�ITest3Nr5rrrrr;Nr6r;c@r3)�ITest4Nr5rrrrr<Rr6r<c@r)�TestcC�dSrrr,rrrr.Xr1z
Test.__init__N�rrrr.rrrrr=Vr2r=c@r)�Test2rcCr>rrr,rrrr.`r1zTest2.__init__N)rrr�temporaryAdapterr.rrrrr@\sr@c@r)�RegistryUsingMixinzH
    Mixin for test cases which modify the global registry somehow.
    cCs,t�}|�td|�t|�}|�t|�dS)z�
        Configure L{twisted.python.components.registerAdapter} to mutate an
        alternate registry to improve test isolation.
        �globalRegistryN)r�patchrr
�
addCleanupr)r�scratchRegistry�hookrrr�setUpiszRegistryUsingMixin.setUpN)rrr�__doc__rHrrrrrBd�rBc@s`eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dS)�ComponentizedTestsz8
    Simple test case for caching in Componentized.
    cCs8t�|�t�ttt�t�ttt�t�ttt	�dSr)
rBrHr�registerAdapterr=r4r9r;r@r:rrrrrH~s
zComponentizedTests.setUpcCsjt�ttt�t�ttt�t�}|�t���dksJ�|�t���dks'J�tt|���	�dks3J�dS)N)rr)�rMr)
rrLr(rrr0r#�getComponentr!r%�r�crrr�testComponentized�sz$ComponentizedTests.testComponentizedcCs�t�}|�t�}|�t�}|�t�}|�t�}||usJ�||us#J�|�|�|�t�}|�t�}||us8J�||us>J�dSr)r8rNr9r:�removeComponent)rrP�co1�co2�co3�co4�co5�co6rrr�testInheritanceAdaptation�s






z,ComponentizedTests.testInheritanceAdaptationcCs>t�}|�t�}|�t�}|�t�}|�|�|�||�dSr)r8rNr9r;r<�assertIsNone�assertIs)rrPrSrUrVrrr�testMultiAdapter�s



z#ComponentizedTests.testMultiAdaptercCsNt��}t�}|�|�t|�|�|�|jt|d�|�|�|�t�d�dS)z�
        Test that a default value specified to Componentized.getComponent if
        there is no component for the requested interface.
        )�defaultN)r�
Componentized�objectr[rNr9)r�
componentizedr]rrr�test_getComponentDefaults�s
z,ComponentizedTests.test_getComponentDefaultscCs<t��}|�tt�|�t�}|�|j|�|�|t�dS)z�
        C{Componentized.setAdapter} sets a component for an interface by
        wrapping the instance with the given adapter class.
        N)	rr^�
setAdapterrr(rN�assertEqualr+�assertIsInstance�rr`�	componentrrr�test_setAdapter�s

z"ComponentizedTests.test_setAdaptercCs>t��}|jtdd�|�t�}|�|j|�|�|t�dS)z�
        C{Componentized.setAdapter} adapts the instance by wrapping it with
        given adapter class, then stores it using C{addComponent}.
        T)�ignoreClassN)	rr^�
addAdapterr(rNrrcr+rdrerrr�test_addAdapter�s

z"ComponentizedTests.test_addAdaptercCs0t��}t�}|�t|�|�|�t�|�dS)zx
        C{Componentized.setComponent} stores the given component using the
        given interface as the key.
        N)rr^r_�setComponentr9r[rN�rr`�objrrr�test_setComponent�sz$ComponentizedTests.test_setComponentcCs8t��}t�}|�t|�|�t�|�|�t��dS)zm
        C{Componentized.setComponent} removes the cached component for the
        given interface.
        N)rr^r_rkr9�unsetComponentrZrNrlrrr�test_unsetComponent�s

z&ComponentizedTests.test_unsetComponentcCs8t��}|�td�t|�}|�d|�|�d|�dS)zR
        C{ReprableComponentized} has a C{__repr__} that lists its cache.
        �hellor9N)r�ReprableComponentizedrkr9�repr�assertIn)r�rc�resultrrr�test_reprableComponentized�s
z-ComponentizedTests.test_reprableComponentizedN)rrrrIrHrQrYr\rargrjrnrprwrrrrrKys	
rKc@r)�AdapterTestszTest adapters.cCs2t�}t|�}|�tjt|�|�t|d��dSr)r_r(�assertRaisesr�CannotAdaptr9rZ)r�o�arrr�testAdapterGetComponent�sz$AdapterTests.testAdapterGetComponentN)rrrrIr}rrrrrx�rrxc@r3)�IMetaNr5rrrrr~�r6r~c@r)�	MetaAddercCs|jj|Srr*�rrrrr�add��z
MetaAdder.addN�rrrr�rrrrr�r2rc@r)�BackwardsAddercCs|jj|Srr*r�rrrr��r�zBackwardsAdder.addNr�rrrrr��r2r�c@r)�
MetaNumberz9
    Integer wrapper for Interface adaptation tests.
    cC�
||_dSrrr�rrrr.�
zMetaNumber.__init__N)rrrrIr.rrrrr��rJr�c@r)�ComponentNumbercCsd|_tj�|�dSr))rrr^r.rrrrr.	szComponentNumber.__init__Nr?rrrrr�r"r�c@� eZdZdZdd�Zdd�ZdS)�ComponentAdderz0
    Adder for componentized adapter tests.
    cCstj�||�|jj|_dSr)r�Adapterr.r+r�rr+rrrr.szComponentAdder.__init__cCs|j|7_|jSrrr�rrrr�szComponentAdder.addN)rrrrIr.r�rrrrr�sr�c@r)�IAttrXz=
    Base interface for test of adapter with C{__cmp__}.
    cCr$)z!
        Return a value.
        Nrrrrr�x"r&zIAttrX.xN�rrrrIr�rrrrr�rJr�c@r)�IAttrXXz@
    Adapted interface for test of adapter with C{__cmp__}.
    cCr$)z+
        Return a tuple of values.
        Nrrrrr�xx-r&z
IAttrXX.xxN)rrrrIr�rrrrr�(rJr�c@r)�XcellentzG
    L{IAttrX} implementation for test of adapter with C{__cmp__}.
    cCr$)z;
        Return a value.

        @return: a value
        �x!rrrrrr�9sz
Xcellent.xNr�rrrrr�3sr�c@s,eZdZdZdZdd�Zdd�Zdd�Zd	S)
�DoubleXAdapterz
    Adapter with __cmp__.
    �*cCr�r)r+r�rrrr.Jr�zDoubleXAdapter.__init__cCs|j��|j��fSr)r+r�rrrrr�MszDoubleXAdapter.xxcCst|j|j�Sr)rr)r�otherrrr�__cmp__PszDoubleXAdapter.__cmp__N)rrrrIrr.r�r�rrrrr�Bsr�c@s$eZdZdd�Zdd�Zdd�ZdS)�MetaInterfaceTestscCs0t�ttt�td�}|�t|��d�d�dS)zS
        Registered adapters can be used to adapt classes to an interface.
        rrMN)rrLrr�r~rcr�)r�nrrr�
test_basicUszMetaInterfaceTests.test_basiccCsJt�ttt�t�}t|��d�t|��d�|�t|��d�d�dS)Nr�)rrLr�r�r~r�rcrOrrr�testComponentizedInteraction]s
z/MetaInterfaceTests.testComponentizedInteractioncCs,t�ttt�tt��}|�d|���dS)N)r�r�)rrLr�r�r�r�rcr�)rr�rrr�testAdapterWithCmpds
z%MetaInterfaceTests.testAdapterWithCmpN)rrrr�r�r�rrrrr�Tsr�c@s�eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zd S)!�RegistrationTestsz)
    Tests for adapter registration.
    cCs0dd�}t�||t�|�t�|td�|�dS)z�
        Register an adapter with L{components.registerAdapter} for the given
        class or interface and verify that the adapter can be looked up with
        L{components.getAdapterFactory}.
        cSr>rr�r{rrr�<lambda>vr&zGRegistrationTests._registerAdapterForClassOrInterface.<locals>.<lambda>N�rrLr9r[�getAdapterFactory�rr+�adapterrrr�#_registerAdapterForClassOrInterfacepsz5RegistrationTests._registerAdapterForClassOrInterfacecC�Gdd�d�}|�|�S)za
        Test that an adapter from a class can be registered and then looked
        up.
        c@r3)zCRegistrationTests.test_registerAdapterForClass.<locals>.TheOriginalNr5rrrr�TheOriginal�r6r�)r��rr�rrr�test_registerAdapterForClassz�
z.RegistrationTests.test_registerAdapterForClasscC�
|�t�S)zf
        Test that an adapter from an interface can be registered and then
        looked up.
        )r�r:rrrr� test_registerAdapterForInterface��
z2RegistrationTests.test_registerAdapterForInterfacecCsLdd�}dd�}t�||t�|�ttj||t�|�t�|td�|�dS)z�
        Verify that L{components.registerAdapter} raises L{ValueError} if the
        from-type/interface and to-interface pair is not unique.
        cSr$�NFrr�rrrr��r&zHRegistrationTests._duplicateAdapterForClassOrInterface.<locals>.<lambda>cSr$�NTrr�rrrr��r&N)rrLr9ry�
ValueErrorr[r�)rr+�firstAdapter�
secondAdapterrrr�$_duplicateAdapterForClassOrInterface�s�z6RegistrationTests._duplicateAdapterForClassOrInterfacecCr�)zz
        Test that attempting to register a second adapter from a class
        raises the appropriate exception.
        c@r3)zDRegistrationTests.test_duplicateAdapterForClass.<locals>.TheOriginalNr5rrrrr��r6r�)r�r�rrr�test_duplicateAdapterForClass�r�z/RegistrationTests.test_duplicateAdapterForClasscCr�)z
        Test that attempting to register a second adapter from an interface
        raises the appropriate exception.
        )r�r:rrrr�!test_duplicateAdapterForInterface�r�z3RegistrationTests.test_duplicateAdapterForInterfacecCs�dd�}dd�}Gdd�dt�}t�|||�dt_zt�|||�|�t�||d�|�Wdt_ndt_w|�ttj|||�|�t�||d�|�dS)	z�
        Verify that when C{components.ALLOW_DUPLICATES} is set to C{True}, new
        adapter registrations for a particular from-type/interface and
        to-interface pair replace older registrations.
        cSr$r�rr�rrrr��r&zORegistrationTests._duplicateAdapterForClassOrInterfaceAllowed.<locals>.<lambda>cSr$r�rr�rrrr��r&c@r3)zSRegistrationTests._duplicateAdapterForClassOrInterfaceAllowed.<locals>.TheInterfaceNr5rrrr�TheInterface�r6r�TNF)rrrL�ALLOW_DUPLICATESr[r�ryr�)rr+r�r�r�rrr�+_duplicateAdapterForClassOrInterfaceAllowed�s$���z=RegistrationTests._duplicateAdapterForClassOrInterfaceAllowedcCr�)z�
        Test that when L{components.ALLOW_DUPLICATES} is set to a true
        value, duplicate registrations from classes are allowed to override
        the original registration.
        c@r3)zKRegistrationTests.test_duplicateAdapterForClassAllowed.<locals>.TheOriginalNr5rrrrr��r6r�)r�r�rrr�$test_duplicateAdapterForClassAllowed�s
z6RegistrationTests.test_duplicateAdapterForClassAllowedcCsGdd�dt�}|�|�S)z�
        Test that when L{components.ALLOW_DUPLICATES} is set to a true
        value, duplicate registrations from interfaces are allowed to
        override the original registration.
        c@r3)zORegistrationTests.test_duplicateAdapterForInterfaceAllowed.<locals>.TheOriginalNr5rrrrr��r6r�)rr�r�rrr�(test_duplicateAdapterForInterfaceAllowed�s
z:RegistrationTests.test_duplicateAdapterForInterfaceAllowedcCsHdd�}t�||tt�|�t�|td�|�|�t�|td�|�dS)zh
        Verify that an adapter can be registered for multiple to-interfaces at a
        time.
        cSr>rrr�rrrr��r&zJRegistrationTests._multipleInterfacesForClassOrInterface.<locals>.<lambda>N)rrLr9r:r[r�r�rrr�&_multipleInterfacesForClassOrInterface�sz8RegistrationTests._multipleInterfacesForClassOrInterfacecCr�)zi
        Test the registration of an adapter from a class to several
        interfaces at once.
        c@r3)zFRegistrationTests.test_multipleInterfacesForClass.<locals>.TheOriginalNr5rrrrr��r6r�)r�r�rrr�test_multipleInterfacesForClass�r�z1RegistrationTests.test_multipleInterfacesForClasscCr�)zn
        Test the registration of an adapter from an interface to several
        interfaces at once.
        )r�r;rrrr�#test_multipleInterfacesForInterface�r�z5RegistrationTests.test_multipleInterfacesForInterfacecCsldd�}dd�}Gdd�d|�}t�||t�t�||t�|�t�|td�|�|�t�|td�|�dS)a 
        Verify that a new adapter can be registered for a particular
        to-interface from a subclass of a type or interface which already has an
        adapter registered to that interface and that the subclass adapter takes
        precedence over the base class adapter.
        cSr$r�rr�rrrr�r&zSRegistrationTests._subclassAdapterRegistrationForClassOrInterface.<locals>.<lambda>cSr$r�rr�rrrr�r&c@r3)zVRegistrationTests._subclassAdapterRegistrationForClassOrInterface.<locals>.TheSubclassNr5rrrr�TheSubclass
r6r�Nr�)rr+r�r�r�rrr�/_subclassAdapterRegistrationForClassOrInterfaces�zARegistrationTests._subclassAdapterRegistrationForClassOrInterfacecCr�)z~
        Test that an adapter to a particular interface can be registered
        from both a class and its subclass.
        c@r3)zORegistrationTests.test_subclassAdapterRegistrationForClass.<locals>.TheOriginalNr5rrrrr�r6r�)r�r�rrr�(test_subclassAdapterRegistrationForClassr�z:RegistrationTests.test_subclassAdapterRegistrationForClasscCr�)z�
        Test that an adapter to a particular interface can be registered
        from both an interface and its subclass.
        )r�r:rrrr�,test_subclassAdapterRegistrationForInterfacer�z>RegistrationTests.test_subclassAdapterRegistrationForInterfaceN)rrrrIr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrr�ks"
 
r�c@s eZdZdZed�Zdd�ZdS)�IProxiedInterfacez=
    An interface class for use by L{proxyForInterface}.
    z@
        An example declared attribute, which should be proxied.cOr$)z:
        A sample method which should be proxied.
        Nr)r|�kwrrr�yay1r&zIProxiedInterface.yayN)rrrrIr�ifaceAttributer�rrrrr�'s�r�c@r)�IProxiedSubInterfacezS
    An interface that derives from another for use with L{proxyForInterface}.
    cCr$)zD
        A different sample method which should be proxied.
        Nrrrrr�boo<r&zIProxiedSubInterface.booN�rrrrIr�rrrrr�7rJr�c@r�)�Yayablez�
    A provider of L{IProxiedInterface} which increments a counter for
    every call to C{yay}.

    @ivar yays: The number of times C{yay} has been called.
    cCsd|_g|_dSr))�yays�yayArgsrrrrr.Mr/zYayable.__init__cOs$|jd7_|j�||f�|jS)z)
        Increment C{self.yays}.
        r)r�r��append�rr|r�rrrr�QszYayable.yayN)rrrrIr.r�rrrrr�Bsr�c@s(eZdZdZdZdZdd�Zdd�ZdS)�Booablez3
    An implementation of IProxiedSubInterface
    FcO�
d|_dS)z;
        Mark the fact that 'yay' has been called.
        TN)�yayedr�rrrr�e�
zBooable.yaycCr�)z<
        Mark the fact that 'boo' has been called.1
        TN)�booedrrrrr�kr�zBooable.booN)rrrrIr�r�r�r�rrrrr�Zsr�c@r�)�IMultipleMethodsz-
    An interface with multiple methods.
    cCr$)z4
        The first method. Should return 1.
        Nrrrrr�	methodOnewr&zIMultipleMethods.methodOnecCr$)z5
        The second method. Should return 2.
        Nrrrrr�	methodTwo|r&zIMultipleMethods.methodTwoN�rrrrIr�r�rrrrr�rsr�c@r�)�MultipleMethodImplementorz:
    A precise implementation of L{IMultipleMethods}.
    cCr$)z
        @return: 1
        rrrrrrr���z#MultipleMethodImplementor.methodOnecCr$)z
        @return: 2
        rMrrrrrr��r�z#MultipleMethodImplementor.methodTwoNr�rrrrr��sr�c@s�eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�ZdS)�ProxyForInterfaceTestsz)
    Tests for L{proxyForInterface}.
    cCs$t�}tt�|�}|�|j|�dS)z�
        Proxy objects should have an C{original} attribute which refers to the
        original object passed to the constructor.
        N)r_rr�r[r+)rr+�proxyrrr�
test_original�sz$ProxyForInterfaceTests.test_originalcCs@tt�}t�}||�}|��|�|��d�|�|jd�dS)z�
        The class created from L{proxyForInterface} passes methods on an
        interface to the object which is passed to its constructor.
        rMN�rr�r�r�rcr�)r�klass�yayabler�rrr�test_proxyMethod�sz'ProxyForInterfaceTests.test_proxyMethodcsDtt��G�fdd�d��}t�}||�}|��|�d|j�dS)z�
        Methods of the class created from L{proxyForInterface} can be used with
        the decorator-helper L{functools.wraps}.
        cs"eZdZe�j��fdd��ZdS)z?ProxyForInterfaceTests.test_decoratedProxyMethod.<locals>.klasscs|jjd7_��|�Sr)r+r�r�r��baserrr��s
zCProxyForInterfaceTests.test_decoratedProxyMethod.<locals>.klass.yayN)rrrrr�rr�rrr��sr�rMNr�)rr�r+r�rr�r�test_decoratedProxyMethod�sz0ProxyForInterfaceTests.test_decoratedProxyMethodcsBt�}t�|_tt�|��|��j|j�|�t�fdd��dS)zc
        Proxy objects should proxy declared attributes, but not other
        attributes.
        cs�jSr)r�r�r�rrr��sz<ProxyForInterfaceTests.test_proxyAttribute.<locals>.<lambda>N)r�r_r�rr�r[ry�AttributeError)rr�rr�r�test_proxyAttribute�s
z*ProxyForInterfaceTests.test_proxyAttributecCs0t�}tt�|�}t�}||_|�|j|�dS)zv
        The attributes that proxy objects proxy should be assignable and affect
        the original object.
        N)r�rr�r_r�r[�rr�r��thingyrrr�test_proxySetAttribute�s
z-ProxyForInterfaceTests.test_proxySetAttributecCs0t�}d|_tt�|�}|`|�t|d��dS)zu
        The attributes that proxy objects proxy should be deletable and affect
        the original object.
        Nr�)r�r�rr��assertFalse�hasattr)rr�r�rrr�test_proxyDeleteAttribute�s
z0ProxyForInterfaceTests.test_proxyDeleteAttributecCs6t�}tt�|�}|�|��d�|�|��d�dS)z�
        [Regression test] The proxy should send its method calls to the correct
        method, not the incorrect one.
        rrMN)r�rr�rcr�r�)r�multir�rrr�test_multipleMethods�sz+ProxyForInterfaceTests.test_multipleMethodscCsJGdd�dtt��}t�}||�}|�|jd�|��|�|jd�dS)zP
        It is possible to subclass the result of L{proxyForInterface}.
        c@r)zAProxyForInterfaceTests.test_subclassing.<locals>.SpecializedProxyzU
            A specialized proxy which can decrement the number of yays.
            cSs|jjd8_dS)z?
                Decrement the number of yays.
                rN)r+r�rrrrr��szEProxyForInterfaceTests.test_subclassing.<locals>.SpecializedProxy.booNr�rrrr�SpecializedProxy�rJr�r���N)rr�r�rcr�r�)rr�r��specialrrr�test_subclassing�sz'ProxyForInterfaceTests.test_subclassingcCstt�}|�|jd�dS)zQ
        The name of a proxy class indicates which interface it proxies.
        zA(Proxy for twisted.python.test.test_components.IProxiedInterface)N)rr�rcr�rr�rrr�test_proxyNames
�z%ProxyForInterfaceTests.test_proxyNamecCstt�}|�t�|��dS)zO
        The resulting proxy implements the interface that it proxies.
        N)rr��
assertTrue�
implementedByr�rrr�test_implementssz&ProxyForInterfaceTests.test_implementscCsbGdd�d�}|�}|�}||_t�dd�}|�|�|�|j�|�d�}||�|�|j�dS)a\
        _ProxyDescriptor's __get__ method should return the appropriate
        attribute of its argument's 'original' attribute if it is invoked with
        an object.  If it is invoked with None, it should return a false
        class-method emulator instead.

        For some reason, Python's documentation recommends to define
        descriptors' __get__ methods with the 'type' parameter as optional,
        despite the fact that Python itself never actually calls the descriptor
        that way.  This is probably do to support 'foo.__get__(bar)' as an
        idiom.  Let's make sure that the behavior is correct.  Since we don't
        actually use the 'type' argument at all, this test calls it the
        idiomatic way to ensure that signature works; test_proxyInheritance
        verifies the how-Python-actually-calls-it signature.
        c@r)z>ProxyForInterfaceTests.test_proxyDescriptorGet.<locals>.SampleFcSs
d|_dSr�)�calledrrrrrq&r�zDProxyForInterfaceTests.test_proxyDescriptorGet.<locals>.Sample.helloN)rrrr�rqrrrr�Sample#rr�rqr+N)r+r�_ProxyDescriptorrc�__get__rqr�r�)rr��	fakeProxy�
testObject�pd�fakeClassMethodrrr�test_proxyDescriptorGets
z.ProxyForInterfaceTests.test_proxyDescriptorGetcspGdd�dtt���G�fdd�d��}t�}||�}|�|jddddd	�d
�|�|jdtddd	�fg�dS)
z�
        Subclasses of the class returned from L{proxyForInterface} should be
        able to upcall methods by reference to their superclass, as any normal
        Python class can.
        c@seZdZdZdS)zDProxyForInterfaceTests.test_proxyInheritance.<locals>.YayableWrapperzI
            This class does not override any functionality.
            N)rrrrIrrrr�YayableWrapper9srcs eZdZdZdZ�fdd�ZdS)zEProxyForInterfaceTests.test_proxyInheritance.<locals>.EnhancedWrapperz@
            This class overrides the 'yay' method.
            rcs*|jd7_�j|g|�Ri|��dS)Nr�)�wrappedYaysr�)rr|�k�rrrr�EszIProxyForInterfaceTests.test_proxyInheritance.<locals>.EnhancedWrapper.yayN)rrrrIrr�rrrr�EnhancedWrapper>srr����)r��y�)r�rN)rr�r�rcr�r��dict)rrr��wrapperrrr�test_proxyInheritance2s z,ProxyForInterfaceTests.test_proxyInheritancecCsBtt�}t�}||�}|��|��|�|j�|�|j�dS)z�
        Proxies of subinterfaces generated with proxyForInterface should allow
        access to attributes of both the child and the base interfaces.
        N)rr�r�r�r�r�r�r�)r�
proxyClass�booabler�rrr�test_interfaceInheritanceNsz0ProxyForInterfaceTests.test_interfaceInheritancecCs~t�}t�|_ttdd�|�}|�|j|�|�|��d�|�|j|j�t�}||_|�|j|�|`|�	t
|d��dS)a
        The original attribute name can be customized via the
        C{originalAttribute} argument of L{proxyForInterface}: the attribute
        should change, but the methods of the original object should still be
        callable, and the attributes still accessible.
        �foo)�originalAttributerr�N)r�r_r�rr�r[rrcr�r�r�r�rrr�test_attributeCustomization[sz2ProxyForInterfaceTests.test_attributeCustomizationN)rrrrIr�r�r�r�r�r�r�r�r�r�r�r
rrrrrrr��s 	

 
r�N);rI�	functoolsr�zope.interfacerrr�zope.interface.adapterr�twisted.pythonr�twisted.python.compatrr	�twisted.python.componentsr
rr�
twisted.trialr
r^rrr#r�r(r0r4r7r8r9r:r;r<r=r@rB�SynchronousTestCaserKrxr~rr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrr�<module>sp

l
	=
Hacker Blog, Shell İndir, Sql İnjection, XSS Attacks, LFI Attacks, Social Hacking, Exploit Bot, Proxy Tools, Web Shell, PHP Shell, Alfa Shell İndir, Hacking Training Set, DDoS Script, Denial Of Service, Botnet, RFI Attacks, Encryption
Telegram @BIBIL_0DAY