§
    Ètºfâd  ã                   óL  — d Z ddlmZ ddlmZmZmZ ddlmZ ddl	m
Z
 ddlmZmZ ddlmZmZmZ ddlmZ  G d	„ d
e
j        ¦  «        Z G d„ de¦  «        Z G d„ de¦  «        Z ee¦  «         G d„ de
j        ¦  «        ¦   «         Z ee¦  «         G d„ de
j        ¦  «        ¦   «         Z G d„ de
j        ¦  «        Z G d„ de¦  «        Z G d„ de¦  «        Z G d„ de¦  «        Z G d„ de¦  «        Z G d„ de¦  «        Z  G d„ d e¦  «        Z! eee e!¦  «         G d!„ d"e
j        ¦  «        ¦   «         Z" ee¦  «         G d#„ d$¦  «        ¦   «         Z# G d%„ d&¦  «        Z$ G d'„ d(ej%        e$¦  «        Z& G d)„ d*ej%        ¦  «        Z' G d+„ d,e¦  «        Z( ee(¦  «         G d-„ d.e
j        ¦  «        ¦   «         Z) ee(¦  «         G d/„ d0e
j        ¦  «        ¦   «         Z* G d1„ d2¦  «        Z+ G d3„ d4e
j        ¦  «        Z, ee(¦  «         G d5„ d6e
j        ¦  «        ¦   «         Z- G d7„ d8e¦  «        Z. G d9„ d:e¦  «        Z/ ee.¦  «         G d;„ d<¦  «        ¦   «         Z0e G d=„ d>¦  «        ¦   «         Z1 G d?„ d@e$ej%        ¦  «        Z2 G dA„ dBe$ej%        ¦  «        Z3 G dC„ dDe¦  «        Z4 G dE„ dFe4¦  «        Z5 ee4¦  «         G dG„ dH¦  «        ¦   «         Z6 ee5¦  «         G dI„ dJ¦  «        ¦   «         Z7 G dK„ dLe¦  «        Z8 G dM„ dN¦  «        Z9 G dO„ dPej%        ¦  «        Z:dQS )Rz0
Test cases for Twisted component architecture.
é    )Úwraps)Ú	AttributeÚ	InterfaceÚimplementer)ÚAdapterRegistry)Ú
components)ÚcmpÚ
comparable)Ú_addHookÚ_removeHookÚproxyForInterface)Úunittestc                   ó   — e Zd ZdZd„ ZdS )ÚCompor   c                 ó.   — | j         dz   | _         | j         S ©Né   ©Únum©Úselfs    úb/var/www/surfInsights/venv3-11/lib/python3.11/site-packages/twisted/python/test/test_components.pyÚincz	Compo.inc   s   € Ø”8˜a‘<ˆŒØŒxˆó    N)Ú__name__Ú
__module__Ú__qualname__r   r   © r   r   r   r      s(   € € € € € Ø
€Cðð ð ð ð r   r   c                   ó   — e Zd Zd„ ZdS )ÚIAdeptc                  ó   — t          ¦   «         ‚©N)ÚNotImplementedErrorr   r   r   ÚadaptorFunczIAdept.adaptorFunc   s   € Ý!Ñ#Ô#Ð#r   N)r   r   r   r$   r   r   r   r    r       s#   € € € € € ð$ð $ð $ð $ð $r   r    c                   ó   — e Zd Zd„ ZdS )ÚIElapsedc                  ó   — dS )z
        1!
        Nr   r   r   r   ÚelapsedFunczIElapsed.elapsedFunc#   ó   € € € r   N©r   r   r   r(   r   r   r   r&   r&   "   s#   € € € € € ðð ð ð ð r   r&   c                   ó   — e Zd Zd„ Zd„ ZdS )ÚAdeptc                 ó"   — || _         d| _        d S ©Nr   ©Úoriginalr   ©r   Úorigs     r   Ú__init__zAdept.__init__+   s   € ØˆŒØˆŒˆˆr   c                 ó`   — | j         dz   | _         | j         | j                             ¦   «         fS r   )r   r0   r   r   s    r   r$   zAdept.adaptorFunc/   s*   € Ø”8˜a‘<ˆŒØŒx˜œ×*Ò*Ñ,Ô,Ð,Ð,r   N)r   r   r   r3   r$   r   r   r   r,   r,   )   s2   € € € € € ðð ð ð-ð -ð -ð -ð -r   r,   c                   ó   — e Zd Zd„ ZdS )ÚElapsedc                 ó   — dS r   r   r   s    r   r(   zElapsed.elapsedFunc6   s   € Øˆqr   Nr*   r   r   r   r6   r6   4   s#   € € € € € ðð ð ð ð r   r6   c                   ó   — e Zd ZdS )ÚACompN©r   r   r   r   r   r   r9   r9   :   ó   € € € € € Ø€Dr   r9   c                   ó   — e Zd ZdS )ÚBCompNr:   r   r   r   r=   r=   >   r;   r   r=   c                   ó   — e Zd ZdS )ÚCCompNr:   r   r   r   r?   r?   B   r;   r   r?   c                   ó   — e Zd ZdS )ÚITestNr:   r   r   r   rA   rA   F   r;   r   rA   c                   ó   — e Zd ZdS )ÚITest2Nr:   r   r   r   rC   rC   J   r;   r   rC   c                   ó   — e Zd ZdS )ÚITest3Nr:   r   r   r   rE   rE   N   r;   r   rE   c                   ó   — e Zd ZdS )ÚITest4Nr:   r   r   r   rG   rG   R   r;   r   rG   c                   ó   — e Zd Zd„ ZdS )ÚTestc                 ó   — d S r"   r   r1   s     r   r3   zTest.__init__X   ó   € Øˆr   N©r   r   r   r3   r   r   r   rI   rI   V   s#   € € € € € ðð ð ð ð r   rI   c                   ó   — e Zd ZdZd„ ZdS )ÚTest2r   c                 ó   — d S r"   r   r1   s     r   r3   zTest2.__init__`   rK   r   N)r   r   r   ÚtemporaryAdapterr3   r   r   r   rN   rN   \   s)   € € € € € àÐðð ð ð ð r   rN   c                   ó   — e Zd ZdZd„ ZdS )ÚRegistryUsingMixinzH
    Mixin for test cases which modify the global registry somehow.
    c                 ó®   — t          ¦   «         }|                      t          d|¦  «         t          |¦  «        }|                      t
          |¦  «         dS )z‹
        Configure L{twisted.python.components.registerAdapter} to mutate an
        alternate registry to improve test isolation.
        ÚglobalRegistryN)r   Úpatchr   r   Ú
addCleanupr   )r   ÚscratchRegistryÚhooks      r   ÚsetUpzRegistryUsingMixin.setUpi   sO   € õ *Ñ+Ô+ˆØ�
Š
•:Ð/°ÑAÔAÐAõ ˜Ñ(Ô(ˆØ�Š� TÑ*Ô*Ð*Ð*Ð*r   N)r   r   r   Ú__doc__rY   r   r   r   rR   rR   d   s-   € € € € € ðð ð+ð +ð +ð +ð +r   rR   c                   óN   — e Zd ZdZd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z	d„ Z
d	„ Zd
„ Zd„ ZdS )ÚComponentizedTestsz8
    Simple test case for caching in Componentized.
    c                 ó  — t                                | ¦  «         t          j        t          t
          t          ¦  «         t          j        t          t
          t          ¦  «         t          j        t          t
          t          ¦  «         d S r"   )
rR   rY   r   ÚregisterAdapterrI   r9   rA   rE   rN   rC   r   s    r   rY   zComponentizedTests.setUp~   s[   € Ý× Ò  Ñ&Ô&Ð&åÔ"¥4­µÑ6Ô6Ð6ÝÔ"¥4­µÑ7Ô7Ð7ÝÔ"¥5­%µÑ8Ô8Ð8Ð8Ð8r   c                 óæ  — t          j        t          t          t          ¦  «         t          j        t
          t          t          ¦  «         t          ¦   «         }|                     t          ¦  «                             ¦   «         dk    sJ ‚|                     t          ¦  «                             ¦   «         dk    sJ ‚t          t	          |¦  «        ¦  «         	                    ¦   «         dk    sJ ‚d S )N)r   r   )é   r`   r   )
r   r^   r,   r   r    r6   r&   ÚgetComponentr$   r(   ©r   Úcs     r   ÚtestComponentizedz$ComponentizedTests.testComponentized…   s¸   € ÝÔ"¥5­%µÑ8Ô8Ð8ÝÔ"¥7­Eµ8Ñ<Ô<Ð<å‰GŒGˆØ�~Š~�fÑ%Ô%×1Ò1Ñ3Ô3°vÒ=Ð=Ð=Ð=Ø�~Š~�fÑ%Ô%×1Ò1Ñ3Ô3°vÒ=Ð=Ð=Ð=Ý�˜q™	œ	Ñ"Ô"×.Ò.Ñ0Ô0°AÒ5Ð5Ð5Ð5Ð5Ð5r   c                 ó´  — t          ¦   «         }|                     t          ¦  «        }|                     t          ¦  «        }|                     t          ¦  «        }|                     t          ¦  «        }||u sJ ‚||usJ ‚|                     |¦  «         |                     t          ¦  «        }|                     t          ¦  «        }||u sJ ‚||usJ ‚d S r"   )r?   ra   rA   rC   ÚremoveComponent)r   rc   Úco1Úco2Úco3Úco4Úco5Úco6s           r   ÚtestInheritanceAdaptationz,ComponentizedTests.testInheritanceAdaptationŽ   s½   € Ý‰GŒGˆØ�nŠn�UÑ#Ô#ˆØ�nŠn�UÑ#Ô#ˆØ�nŠn�VÑ$Ô$ˆØ�nŠn�VÑ$Ô$ˆØ�cˆzˆzˆzˆzØ˜#ˆ~ˆ~ˆ~ˆ~Ø	×Ò˜#ÑÔÐØ�nŠn�UÑ#Ô#ˆØ�nŠn�UÑ#Ô#ˆØ�cˆzˆzˆzˆzØ˜#ˆ~ˆ~ˆ~ˆ~ˆ~ˆ~r   c                 ó  — t          ¦   «         }|                     t          ¦  «        }|                     t          ¦  «        }|                     t          ¦  «        }|                      |¦  «         |                      ||¦  «         d S r"   )r?   ra   rA   rE   rG   ÚassertIsNoneÚassertIs)r   rc   rg   ri   rj   s        r   ÚtestMultiAdapterz#ComponentizedTests.testMultiAdapterœ   sl   € Ý‰GŒGˆØ�nŠn�UÑ#Ô#ˆØ�nŠn�VÑ$Ô$ˆØ�nŠn�VÑ$Ô$ˆØ×Ò˜#ÑÔÐØ�Š�c˜3ÑÔÐÐÐr   c                 ób  — t          j        ¦   «         }t          ¦   «         }|                      |                     t
          |¦  «        |¦  «         |                      |                     t
          |¬¦  «        |¦  «         |                      |                     t
          ¦  «        d¦  «         dS )z‘
        Test that a default value specified to Componentized.getComponent if
        there is no component for the requested interface.
        )ÚdefaultN)r   ÚComponentizedÚobjectrp   ra   rA   )r   Úcomponentizedrs   s      r   Útest_getComponentDefaultsz,ComponentizedTests.test_getComponentDefaults¤   sŽ   € õ
 #Ô0Ñ2Ô2ˆÝ‘(”(ˆØ�Š�m×0Ò0µ¸Ñ@Ô@À'ÑJÔJÐJØ�Š�m×0Ò0µÀÐ0ÑHÔHÈ'ÑRÔRÐRØ�Š�m×0Ò0µÑ7Ô7¸Ñ>Ô>Ð>Ð>Ð>r   c                 ó  — t          j        ¦   «         }|                     t          t          ¦  «         |                     t          ¦  «        }|                      |j        |¦  «         |                      |t          ¦  «         dS )zŽ
        C{Componentized.setAdapter} sets a component for an interface by
        wrapping the instance with the given adapter class.
        N)	r   rt   Ú
setAdapterr    r,   ra   ÚassertEqualr0   ÚassertIsInstance©r   rv   Ú	components      r   Útest_setAdapterz"ComponentizedTests.test_setAdapter¯   sp   € õ
 #Ô0Ñ2Ô2ˆØ× Ò ¥­Ñ/Ô/Ð/Ø!×.Ò.­vÑ6Ô6ˆ	Ø×Ò˜Ô+¨]Ñ;Ô;Ð;Ø×Ò˜i­Ñ/Ô/Ð/Ð/Ð/r   c                 ó  — t          j        ¦   «         }|                     t          d¬¦  «         |                     t
          ¦  «        }|                      |j        |¦  «         |                      |t          ¦  «         dS )z˜
        C{Componentized.setAdapter} adapts the instance by wrapping it with
        given adapter class, then stores it using C{addComponent}.
        T)ÚignoreClassN)	r   rt   Ú
addAdapterr,   ra   r    rz   r0   r{   r|   s      r   Útest_addAdapterz"ComponentizedTests.test_addAdapterº   ss   € õ
 #Ô0Ñ2Ô2ˆØ× Ò ¥°DÐ Ñ9Ô9Ð9Ø!×.Ò.­vÑ6Ô6ˆ	Ø×Ò˜Ô+¨]Ñ;Ô;Ð;Ø×Ò˜i­Ñ/Ô/Ð/Ð/Ð/r   c                 óÚ   — t          j        ¦   «         }t          ¦   «         }|                     t          |¦  «         |                      |                     t          ¦  «        |¦  «         dS )zx
        C{Componentized.setComponent} stores the given component using the
        given interface as the key.
        N)r   rt   ru   ÚsetComponentrA   rp   ra   ©r   rv   Úobjs      r   Útest_setComponentz$ComponentizedTests.test_setComponentÅ   sY   € õ
 #Ô0Ñ2Ô2ˆÝ‰hŒhˆØ×"Ò"¥5¨#Ñ.Ô.Ð.Ø�Š�m×0Ò0µÑ7Ô7¸Ñ=Ô=Ð=Ð=Ð=r   c                 ó  — t          j        ¦   «         }t          ¦   «         }|                     t          |¦  «         |                     t          ¦  «         |                      |                     t          ¦  «        ¦  «         dS )zm
        C{Componentized.setComponent} removes the cached component for the
        given interface.
        N)r   rt   ru   r„   rA   ÚunsetComponentro   ra   r…   s      r   Útest_unsetComponentz&ComponentizedTests.test_unsetComponentÏ   sm   € õ
 #Ô0Ñ2Ô2ˆÝ‰hŒhˆØ×"Ò"¥5¨#Ñ.Ô.Ð.Ø×$Ò$¥UÑ+Ô+Ð+Ø×Ò˜-×4Ò4µUÑ;Ô;Ñ<Ô<Ð<Ð<Ð<r   c                 óØ   — t          j        ¦   «         }|                     t          d¦  «         t	          |¦  «        }|                      d|¦  «         |                      d|¦  «         dS )zR
        C{ReprableComponentized} has a C{__repr__} that lists its cache.
        ÚhellorA   N)r   ÚReprableComponentizedr„   rA   ÚreprÚassertIn)r   ÚrcÚresults      r   Útest_reprableComponentizedz-ComponentizedTests.test_reprableComponentizedÚ   s_   € õ Ô-Ñ/Ô/ˆØ
�Š�˜wÑ'Ô'Ð'Ý�b‘”ˆØ�Š�g˜vÑ&Ô&Ð&Ø�Š�g˜vÑ&Ô&Ð&Ð&Ð&r   N)r   r   r   rZ   rY   rd   rm   rq   rw   r~   r‚   r‡   rŠ   r’   r   r   r   r\   r\   y   s´   € € € € € ðð ð9ð 9ð 9ð6ð 6ð 6ðð ð ð ð  ð  ð	?ð 	?ð 	?ð	0ð 	0ð 	0ð	0ð 	0ð 	0ð>ð >ð >ð	=ð 	=ð 	=ð'ð 'ð 'ð 'ð 'r   r\   c                   ó   — e Zd ZdZd„ ZdS )ÚAdapterTestszTest adapters.c                 óÒ   — t          ¦   «         }t          |¦  «        }|                      t          j        t
          |¦  «         |                      t          |d ¦  «        ¦  «         d S r"   )ru   r,   ÚassertRaisesr   ÚCannotAdaptrA   ro   )r   ÚoÚas      r   ÚtestAdapterGetComponentz$AdapterTests.testAdapterGetComponentè   sS   € Ý‰HŒHˆÝ�!‰HŒHˆØ×Ò�*Ô0µ%¸Ñ;Ô;Ð;Ø×Ò�%  4™.œ.Ñ)Ô)Ð)Ð)Ð)r   N)r   r   r   rZ   rš   r   r   r   r”   r”   å   s)   € € € € € ØÐð*ð *ð *ð *ð *r   r”   c                   ó   — e Zd ZdS )ÚIMetaNr:   r   r   r   rœ   rœ   ï   r;   r   rœ   c                   ó   — e Zd Zd„ ZdS )Ú	MetaAdderc                 ó    — | j         j        |z   S r"   r/   ©r   r   s     r   ÚaddzMetaAdder.addõ   ó   € ØŒ}Ô  3Ñ&Ð&r   N©r   r   r   r¡   r   r   r   rž   rž   ó   ó#   € € € € € ð'ð 'ð 'ð 'ð 'r   rž   c                   ó   — e Zd Zd„ ZdS )ÚBackwardsAdderc                 ó    — | j         j        |z
  S r"   r/   r    s     r   r¡   zBackwardsAdder.addû   r¢   r   Nr£   r   r   r   r¦   r¦   ù   r¤   r   r¦   c                   ó   — e Zd ZdZd„ ZdS )Ú
MetaNumberz9
    Integer wrapper for Interface adaptation tests.
    c                 ó   — || _         d S r"   r   r    s     r   r3   zMetaNumber.__init__  s   € ØˆŒˆˆr   N)r   r   r   rZ   r3   r   r   r   r©   r©   ÿ   s-   € € € € € ðð ðð ð ð ð r   r©   c                   ó   — e Zd Zd„ ZdS )ÚComponentNumberc                 óR   — d| _         t          j                             | ¦  «         d S r.   )r   r   rt   r3   r   s    r   r3   zComponentNumber.__init__	  s&   € ØˆŒÝÔ ×)Ò)¨$Ñ/Ô/Ð/Ð/Ð/r   NrL   r   r   r   r¬   r¬     s#   € € € € € ð0ð 0ð 0ð 0ð 0r   r¬   c                   ó   — e Zd ZdZd„ Zd„ ZdS )ÚComponentAdderz0
    Adder for componentized adapter tests.
    c                 óh   — t           j                             | |¦  «         | j        j        | _        d S r"   )r   ÚAdapterr3   r0   r   ©r   r0   s     r   r3   zComponentAdder.__init__  s+   € ÝÔ×#Ò# D¨(Ñ3Ô3Ð3Ø”=Ô$ˆŒˆˆr   c                 ó0   — | xj         |z  c_         | j         S r"   r   r    s     r   r¡   zComponentAdder.add  s   € ØˆŒ�C‰ˆŒØŒxˆr   N)r   r   r   rZ   r3   r¡   r   r   r   r¯   r¯     s<   € € € € € ðð ð%ð %ð %ðð ð ð ð r   r¯   c                   ó   — e Zd ZdZd„ ZdS )ÚIAttrXz=
    Base interface for test of adapter with C{__cmp__}.
    c                  ó   — dS )z!
        Return a value.
        Nr   r   r   r   ÚxzIAttrX.x"  r)   r   N©r   r   r   rZ   r·   r   r   r   rµ   rµ     ó-   € € € € € ðð ðð ð ð ð r   rµ   c                   ó   — e Zd ZdZd„ ZdS )ÚIAttrXXz@
    Adapted interface for test of adapter with C{__cmp__}.
    c                  ó   — dS )z+
        Return a tuple of values.
        Nr   r   r   r   Úxxz
IAttrXX.xx-  r)   r   N)r   r   r   rZ   r½   r   r   r   r»   r»   (  r¹   r   r»   c                   ó   — e Zd ZdZd„ ZdS )ÚXcellentzG
    L{IAttrX} implementation for test of adapter with C{__cmp__}.
    c                 ó   — dS )z;
        Return a value.

        @return: a value
        úx!r   r   s    r   r·   z
Xcellent.x9  s	   € ð ˆtr   Nr¸   r   r   r   r¿   r¿   3  s-   € € € € € ðð ðð ð ð ð r   r¿   c                   ó(   — e Zd ZdZdZd„ Zd„ Zd„ ZdS )ÚDoubleXAdapterz
    Adapter with __cmp__.
    é*   c                 ó   — || _         d S r"   )r0   r²   s     r   r3   zDoubleXAdapter.__init__J  s   € Ø ˆŒˆˆr   c                 óf   — | j                              ¦   «         | j                              ¦   «         fS r"   )r0   r·   r   s    r   r½   zDoubleXAdapter.xxM  s%   € Ø”—’Ñ!Ô! 4¤=§?¢?Ñ#4Ô#4Ð5Ð5r   c                 ó6   — t          | j        |j        ¦  «        S r"   )r	   r   )r   Úothers     r   Ú__cmp__zDoubleXAdapter.__cmp__P  s   € Ý�4”8˜UœYÑ'Ô'Ð'r   N)r   r   r   rZ   r   r3   r½   rÉ   r   r   r   rÃ   rÃ   B  sR   € € € € € ðð ð €Cð!ð !ð !ð6ð 6ð 6ð(ð (ð (ð (ð (r   rÃ   c                   ó    — e Zd Zd„ Zd„ Zd„ ZdS )ÚMetaInterfaceTestsc                 óÚ   — t          j        t          t          t          ¦  «         t          d¦  «        }|                      t	          |¦  «                             d¦  «        d¦  «         dS )zS
        Registered adapters can be used to adapt classes to an interface.
        r   r`   N)r   r^   rž   r©   rœ   rz   r¡   )r   Úns     r   Ú
test_basiczMetaInterfaceTests.test_basicU  sP   € õ 	Ô"¥9­j½%Ñ@Ô@Ð@Ý�q‰MŒMˆØ×Ò�˜q™œŸš a™œ¨!Ñ,Ô,Ð,Ð,Ð,r   c                 ó`  — t          j        t          t          t          ¦  «         t          ¦   «         }t	          |¦  «                             d¦  «         t	          |¦  «                             d¦  «         |                      t	          |¦  «                             d¦  «        d¦  «         d S )Nr   é   )r   r^   r¯   r¬   rœ   r¡   rz   rb   s     r   ÚtestComponentizedInteractionz/MetaInterfaceTests.testComponentizedInteraction]  sx   € ÝÔ"¥>µ?ÅEÑJÔJÐJÝÑÔˆÝˆa‰Œ�Š�Q‰ŒˆÝˆa‰Œ�Š�Q‰ŒˆØ×Ò�˜q™œŸš a™œ¨!Ñ,Ô,Ð,Ð,Ð,r   c                 óÖ   — t          j        t          t          t          ¦  «         t	          t          ¦   «         ¦  «        }|                      d|                     ¦   «         ¦  «         d S )N)rÁ   rÁ   )r   r^   rÃ   rµ   r»   r¿   rz   r½   )r   r½   s     r   ÚtestAdapterWithCmpz%MetaInterfaceTests.testAdapterWithCmpd  sL   € åÔ"¥>µ6½7ÑCÔCÐCÝ•X‘Z”ZÑ Ô ˆØ×Ò˜ r§u¢u¡w¤wÑ/Ô/Ð/Ð/Ð/r   N)r   r   r   rÎ   rÑ   rÓ   r   r   r   rË   rË   T  sA   € € € € € ð-ð -ð -ð-ð -ð -ð0ð 0ð 0ð 0ð 0r   rË   c                   ól   — e Zd ZdZd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z	d„ Z
d	„ Zd
„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ ZdS )ÚRegistrationTestsz)
    Tests for adapter registration.
    c                 ó    — d„ }t          j        ||t          ¦  «         |                      t          j        |t          d¦  «        |¦  «         dS )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}.
        c                 ó   — d S r"   r   ©r˜   s    r   ú<lambda>zGRegistrationTests._registerAdapterForClassOrInterface.<locals>.<lambda>v  ó   € ˜D€ r   N©r   r^   rA   rp   ÚgetAdapterFactory©r   r0   Úadapters      r   Ú#_registerAdapterForClassOrInterfacez5RegistrationTests._registerAdapterForClassOrInterfacep  sI   € ð !�.ˆÝÔ" 7¨HµeÑ<Ô<Ð<Ø�Š•jÔ2°8½UÀDÑIÔIÈ7ÑSÔSÐSÐSÐSr   c                 óF   —  G d„ d¦  «        }|                       |¦  «        S )za
        Test that an adapter from a class can be registered and then looked
        up.
        c                   ó   — e Zd ZdS )úCRegistrationTests.test_registerAdapterForClass.<locals>.TheOriginalNr:   r   r   r   ÚTheOriginalrâ   €  ó   € € € € € ØˆDr   rã   )rß   ©r   rã   s     r   Útest_registerAdapterForClassz.RegistrationTests.test_registerAdapterForClassz  s@   € ð	ð 	ð 	ð 	ð 	ñ 	ô 	ð 	ð ×7Ò7¸ÑDÔDÐDr   c                 ó6   — |                       t          ¦  «        S )zf
        Test that an adapter from an interface can be registered and then
        looked up.
        )rß   rC   r   s    r   Ú test_registerAdapterForInterfacez2RegistrationTests.test_registerAdapterForInterface…  s   € ð
 ×7Ò7½Ñ?Ô?Ð?r   c                 ó   — d„ }d„ }t          j        ||t          ¦  «         |                      t          t           j        ||t          ¦  «         |                      t          j        |t          d¦  «        |¦  «         dS )z˜
        Verify that L{components.registerAdapter} raises L{ValueError} if the
        from-type/interface and to-interface pair is not unique.
        c                 ó   — dS ©NFr   rØ   s    r   rÙ   zHRegistrationTests._duplicateAdapterForClassOrInterface.<locals>.<lambda>‘  ó   €  € r   c                 ó   — dS ©NTr   rØ   s    r   rÙ   zHRegistrationTests._duplicateAdapterForClassOrInterface.<locals>.<lambda>’  ó   €  $€ r   N)r   r^   rA   r–   Ú
ValueErrorrp   rÜ   )r   r0   ÚfirstAdapterÚsecondAdapters       r   Ú$_duplicateAdapterForClassOrInterfacez6RegistrationTests._duplicateAdapterForClassOrInterfaceŒ  sx   € ð
 '�ˆØ&˜ˆÝÔ" <°½5ÑAÔAÐAØ×ÒÝ�
Ô2°MÀ8ÍUñ	
ô 	
ð 	
ð 	�Š•jÔ2°8½UÀDÑIÔIÈ<ÑXÔXÐXÐXÐXr   c                 óF   —  G d„ d¦  «        }|                       |¦  «        S )zz
        Test that attempting to register a second adapter from a class
        raises the appropriate exception.
        c                   ó   — e Zd ZdS )úDRegistrationTests.test_duplicateAdapterForClass.<locals>.TheOriginalNr:   r   r   r   rã   rö      rä   r   rã   )ró   rå   s     r   Útest_duplicateAdapterForClassz/RegistrationTests.test_duplicateAdapterForClassš  s@   € ð	ð 	ð 	ð 	ð 	ñ 	ô 	ð 	ð ×8Ò8¸ÑEÔEÐEr   c                 ó6   — |                       t          ¦  «        S )z
        Test that attempting to register a second adapter from an interface
        raises the appropriate exception.
        )ró   rC   r   s    r   Ú!test_duplicateAdapterForInterfacez3RegistrationTests.test_duplicateAdapterForInterface¥  s   € ð
 ×8Ò8½Ñ@Ô@Ð@r   c                 óÞ  — d„ }d„ } G d„ dt           ¦  «        }t          j        |||¦  «         dt          _        	 t          j        |||¦  «         |                      t          j        ||d¦  «        |¦  «         dt          _        n# dt          _        w xY w|                      t          t          j        |||¦  «         |                      t          j        ||d¦  «        |¦  «         dS )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.
        c                 ó   — dS rë   r   rØ   s    r   rÙ   zORegistrationTests._duplicateAdapterForClassOrInterfaceAllowed.<locals>.<lambda>²  rì   r   c                 ó   — dS rî   r   rØ   s    r   rÙ   zORegistrationTests._duplicateAdapterForClassOrInterfaceAllowed.<locals>.<lambda>³  rï   r   c                   ó   — e Zd ZdS )úSRegistrationTests._duplicateAdapterForClassOrInterfaceAllowed.<locals>.TheInterfaceNr:   r   r   r   ÚTheInterfacerþ   µ  rä   r   rÿ   TNF)r   r   r^   ÚALLOW_DUPLICATESrp   rÜ   r–   rð   )r   r0   rñ   rò   rÿ   s        r   Ú+_duplicateAdapterForClassOrInterfaceAllowedz=RegistrationTests._duplicateAdapterForClassOrInterfaceAllowed¬  s  € ð '�ˆØ&˜ˆð	ð 	ð 	ð 	ð 	�9ñ 	ô 	ð 	õ 	Ô" <°¸<ÑHÔHÐHØ&*�
Ô#ð	0ÝÔ& }°hÀÑMÔMÐMØ�MŠMÝÔ,¨X°|ÀTÑJÔJØñô ð ð
 +0�JÔ'Ð'ø¨%�JÔ'Ð/Ð/Ð/Ð/ð 	×ÒÝ�
Ô2°LÀ(ÈLñ	
ô 	
ð 	
ð 	�ŠÝÔ(¨°<ÀÑFÔFÈñ	
ô 	
ð 	
ð 	
ð 	
s   ½A B
 Â
Bc                 óF   —  G d„ d¦  «        }|                       |¦  «        S )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                   ó   — e Zd ZdS )úKRegistrationTests.test_duplicateAdapterForClassAllowed.<locals>.TheOriginalNr:   r   r   r   rã   r  Ó  rä   r   rã   )r  rå   s     r   Ú$test_duplicateAdapterForClassAllowedz6RegistrationTests.test_duplicateAdapterForClassAllowedÌ  s@   € ð	ð 	ð 	ð 	ð 	ñ 	ô 	ð 	ð ×?Ò?ÀÑLÔLÐLr   c                 óR   —  G d„ dt           ¦  «        }|                      |¦  «        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                   ó   — e Zd ZdS )úORegistrationTests.test_duplicateAdapterForInterfaceAllowed.<locals>.TheOriginalNr:   r   r   r   rã   r  ß  rä   r   rã   )r   r  rå   s     r   Ú(test_duplicateAdapterForInterfaceAllowedz:RegistrationTests.test_duplicateAdapterForInterfaceAllowedØ  sB   € ð	ð 	ð 	ð 	ð 	�)ñ 	ô 	ð 	ð ×?Ò?ÀÑLÔLÐLr   c                 ó
  — d„ }t          j        ||t          t          ¦  «         |                      t          j        |t          d¦  «        |¦  «         |                      t          j        |t          d¦  «        |¦  «         dS )zh
        Verify that an adapter can be registered for multiple to-interfaces at a
        time.
        c                 ó   — d S r"   r   rØ   s    r   rÙ   zJRegistrationTests._multipleInterfacesForClassOrInterface.<locals>.<lambda>é  rÚ   r   N)r   r^   rA   rC   rp   rÜ   rÝ   s      r   Ú&_multipleInterfacesForClassOrInterfacez8RegistrationTests._multipleInterfacesForClassOrInterfaceä  sn   € ð
 !�.ˆÝÔ" 7¨Hµe½VÑDÔDÐDØ�Š•jÔ2°8½UÀDÑIÔIÈ7ÑSÔSÐSØ�Š•jÔ2°8½VÀTÑJÔJÈGÑTÔTÐTÐTÐTr   c                 óF   —  G d„ d¦  «        }|                       |¦  «        S )zi
        Test the registration of an adapter from a class to several
        interfaces at once.
        c                   ó   — e Zd ZdS )úFRegistrationTests.test_multipleInterfacesForClass.<locals>.TheOriginalNr:   r   r   r   rã   r  ô  rä   r   rã   )r  rå   s     r   Útest_multipleInterfacesForClassz1RegistrationTests.test_multipleInterfacesForClassî  s@   € ð	ð 	ð 	ð 	ð 	ñ 	ô 	ð 	ð ×:Ò:¸;ÑGÔGÐGr   c                 ó6   — |                       t          ¦  «        S )zn
        Test the registration of an adapter from an interface to several
        interfaces at once.
        )r  rE   r   s    r   Ú#test_multipleInterfacesForInterfacez5RegistrationTests.test_multipleInterfacesForInterfaceù  s   € ð
 ×:Ò:½6ÑBÔBÐBr   c                 óV  — d„ }d„ } G d„ d|¦  «        }t          j        ||t          ¦  «         t          j        ||t          ¦  «         |                      t          j        |t          d¦  «        |¦  «         |                      t          j        |t          d¦  «        |¦  «         dS )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.
        c                 ó   — dS rî   r   rØ   s    r   rÙ   zSRegistrationTests._subclassAdapterRegistrationForClassOrInterface.<locals>.<lambda>  s   €  € r   c                 ó   — dS rë   r   rØ   s    r   rÙ   zSRegistrationTests._subclassAdapterRegistrationForClassOrInterface.<locals>.<lambda>  s   €  %€ r   c                   ó   — e Zd ZdS )úVRegistrationTests._subclassAdapterRegistrationForClassOrInterface.<locals>.TheSubclassNr:   r   r   r   ÚTheSubclassr  
  rä   r   r  NrÛ   )r   r0   rñ   rò   r  s        r   Ú/_subclassAdapterRegistrationForClassOrInterfacezARegistrationTests._subclassAdapterRegistrationForClassOrInterface   s¿   € ð &�~ˆØ'˜ˆð	ð 	ð 	ð 	ð 	˜(ñ 	ô 	ð 	õ 	Ô" <°½5ÑAÔAÐAÝÔ" =°+½uÑEÔEÐEØ�Š•jÔ2°8½UÀDÑIÔIÈ<ÑXÔXÐXØ�ŠÝÔ(¨µe¸TÑBÔBÀMñ	
ô 	
ð 	
ð 	
ð 	
r   c                 óF   —  G d„ d¦  «        }|                       |¦  «        S )z~
        Test that an adapter to a particular interface can be registered
        from both a class and its subclass.
        c                   ó   — e Zd ZdS )úORegistrationTests.test_subclassAdapterRegistrationForClass.<locals>.TheOriginalNr:   r   r   r   rã   r    rä   r   rã   )r  rå   s     r   Ú(test_subclassAdapterRegistrationForClassz:RegistrationTests.test_subclassAdapterRegistrationForClass  s@   € ð	ð 	ð 	ð 	ð 	ñ 	ô 	ð 	ð ×CÒCÀKÑPÔPÐPr   c                 ó6   — |                       t          ¦  «        S )zƒ
        Test that an adapter to a particular interface can be registered
        from both an interface and its subclass.
        )r  rC   r   s    r   Ú,test_subclassAdapterRegistrationForInterfacez>RegistrationTests.test_subclassAdapterRegistrationForInterface  s   € ð
 ×CÒCÅFÑKÔKÐKr   N)r   r   r   rZ   rß   ræ   rè   ró   r÷   rù   r  r  r	  r  r  r  r  r  r  r   r   r   rÕ   rÕ   k  s)  € € € € € ðð ðTð Tð Tð	Eð 	Eð 	Eð@ð @ð @ðYð Yð Yð	Fð 	Fð 	FðAð Að Að
ð 
ð 
ð@
Mð 
Mð 
Mð
Mð 
Mð 
MðUð Uð Uð	Hð 	Hð 	HðCð Cð Cð
ð 
ð 
ð(	Qð 	Qð 	QðLð Lð Lð Lð Lr   rÕ   c                   ó.   — e Zd ZdZ ed¦  «        Zd„ ZdS )ÚIProxiedInterfacez=
    An interface class for use by L{proxyForInterface}.
    z@
        An example declared attribute, which should be proxied.c                  ó   — dS )z:
        A sample method which should be proxied.
        Nr   )r™   Úkws     r   ÚyayzIProxiedInterface.yay1  r)   r   N)r   r   r   rZ   r   ÚifaceAttributer$  r   r   r   r!  r!  '  sF   € € € € € ðð ð �Yð	Cñô €Nð
ð ð ð ð r   r!  c                   ó   — e Zd ZdZd„ ZdS )ÚIProxiedSubInterfacezS
    An interface that derives from another for use with L{proxyForInterface}.
    c                  ó   — dS )zD
        A different sample method which should be proxied.
        Nr   r   r   r   ÚboozIProxiedSubInterface.boo<  r)   r   N©r   r   r   rZ   r)  r   r   r   r'  r'  7  r¹   r   r'  c                   ó   — e Zd ZdZd„ Zd„ ZdS )Ú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.
    c                 ó"   — d| _         g | _        d S r.   )ÚyaysÚyayArgsr   s    r   r3   zYayable.__init__M  s   € ØˆŒ	ØˆŒˆˆr   c                 óh   — | xj         dz  c_         | j                             ||f¦  «         | j         S )z)
        Increment C{self.yays}.
        r   )r.  r/  Úappend©r   r™   r#  s      r   r$  zYayable.yayQ  s5   € ð 	ˆ	Œ	�Q‰ˆ	Œ	ØŒ×Ò˜Q ˜GÑ$Ô$Ð$ØŒyÐr   N)r   r   r   rZ   r3   r$  r   r   r   r,  r,  B  s<   € € € € € ðð ðð ð ðð ð ð ð r   r,  c                   ó&   — e Zd ZdZdZdZd„ Zd„ ZdS )ÚBooablez3
    An implementation of IProxiedSubInterface
    Fc                 ó   — d| _         dS )z;
        Mark the fact that 'yay' has been called.
        TN)Úyayedr2  s      r   r$  zBooable.yaye  ó   € ð ˆŒ
ˆ
ˆ
r   c                 ó   — d| _         dS )z<
        Mark the fact that 'boo' has been called.1
        TN)Úbooedr   s    r   r)  zBooable.book  r7  r   N)r   r   r   rZ   r6  r9  r$  r)  r   r   r   r4  r4  Z  sH   € € € € € ðð ð €EØ€Eðð ð ðð ð ð ð r   r4  c                   ó   — e Zd ZdZd„ Zd„ ZdS )ÚIMultipleMethodsz-
    An interface with multiple methods.
    c                  ó   — dS )z4
        The first method. Should return 1.
        Nr   r   r   r   Ú	methodOnezIMultipleMethods.methodOnew  r)   r   c                  ó   — dS )z5
        The second method. Should return 2.
        Nr   r   r   r   Ú	methodTwozIMultipleMethods.methodTwo|  r)   r   N©r   r   r   rZ   r=  r?  r   r   r   r;  r;  r  s<   € € € € € ðð ðð ð ð
ð ð ð ð r   r;  c                   ó   — e Zd ZdZd„ Zd„ ZdS )ÚMultipleMethodImplementorz:
    A precise implementation of L{IMultipleMethods}.
    c                 ó   — dS )z
        @return: 1
        r   r   r   s    r   r=  z#MultipleMethodImplementor.methodOne‡  ó	   € ð ˆqr   c                 ó   — dS )z
        @return: 2
        r`   r   r   s    r   r?  z#MultipleMethodImplementor.methodTwo�  rD  r   Nr@  r   r   r   rB  rB  ‚  s<   € € € € € ðð ðð ð ðð ð ð ð r   rB  c                   óf   — e Zd ZdZd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z	d„ Z
d	„ Zd
„ Zd„ Zd„ Zd„ Zd„ Zd„ ZdS )ÚProxyForInterfaceTestsz)
    Tests for L{proxyForInterface}.
    c                 ó’   — t          ¦   «         } t          t          ¦  «        |¦  «        }|                      |j        |¦  «         dS )z‹
        Proxy objects should have an C{original} attribute which refers to the
        original object passed to the constructor.
        N)ru   r   r!  rp   r0   )r   r0   Úproxys      r   Útest_originalz$ProxyForInterfaceTests.test_original™  sB   € õ
 ‘8”8ˆØ4Õ!Õ"3Ñ4Ô4°XÑ>Ô>ˆØ�Š�e”n hÑ/Ô/Ð/Ð/Ð/r   c                 ó  — t          t          ¦  «        }t          ¦   «         } ||¦  «        }|                     ¦   «          |                      |                     ¦   «         d¦  «         |                      |j        d¦  «         dS )z–
        The class created from L{proxyForInterface} passes methods on an
        interface to the object which is passed to its constructor.
        r`   N©r   r!  r,  r$  rz   r.  )r   ÚklassÚyayablerI  s       r   Útest_proxyMethodz'ProxyForInterfaceTests.test_proxyMethod¢  sq   € õ
 "Õ"3Ñ4Ô4ˆÝ‘)”)ˆØ��g‘”ˆØ�	Š	‰ŒˆØ×Ò˜Ÿš™œ aÑ(Ô(Ð(Ø×Ò˜œ qÑ)Ô)Ð)Ð)Ð)r   c                 óà   ‡— t          t          ¦  «        Š G ˆfd„d‰¦  «        }t          ¦   «         } ||¦  «        }|                     ¦   «          |                      d|j        ¦  «         dS )zŠ
        Methods of the class created from L{proxyForInterface} can be used with
        the decorator-helper L{functools.wraps}.
        c                   óF   •— e Zd Z e” j        ¦  «        ˆ fd„¦   «         ZdS )ú?ProxyForInterfaceTests.test_decoratedProxyMethod.<locals>.klassc                 óX   •— | j         xj        dz  c_        ‰                     | ¦  «        S r   )r0   r.  r$  )r   Úbases    €r   r$  zCProxyForInterfaceTests.test_decoratedProxyMethod.<locals>.klass.yay¶  s)   ø€ à”Ð"Ô" aÑ'Ð"Ô"Ø—x’x ‘~”~Ð%r   N)r   r   r   r   r$  )rT  s   €r   rM  rR  µ  sB   ø€ € € € € ØˆU�4”8‰_Œ_ð&ð &ð &ð &ñ Œ_ð&ð &ð &r   rM  r`   NrL  )r   rM  r0   rN  rT  s       @r   Útest_decoratedProxyMethodz0ProxyForInterfaceTests.test_decoratedProxyMethod®  sŠ   ø€ õ
 !Õ!2Ñ3Ô3ˆð	&ð 	&ð 	&ð 	&ð 	&ð 	&ð 	&�Dñ 	&ô 	&ð 	&õ ‘9”9ˆØ�%˜‘/”/ˆØ�Š‰ŒˆØ×Ò˜˜HœMÑ*Ô*Ð*Ð*Ð*r   c                 ó   ‡— t          ¦   «         }t          ¦   «         |_         t          t          ¦  «        |¦  «        Š|                      ‰j        |j        ¦  «         |                      t          ˆfd„¦  «         dS )zc
        Proxy objects should proxy declared attributes, but not other
        attributes.
        c                  ó   •— ‰ j         S r"   )r.  )rI  s   €r   rÙ   z<ProxyForInterfaceTests.test_proxyAttribute.<locals>.<lambda>É  s	   ø€ °%´*€ r   N)r,  ru   r%  r   r!  rp   r–   ÚAttributeError©r   rN  rI  s     @r   Útest_proxyAttributez*ProxyForInterfaceTests.test_proxyAttributeÀ  ss   ø€ õ
 ‘)”)ˆÝ!'¡¤ˆÔØ4Õ!Õ"3Ñ4Ô4°WÑ=Ô=ˆØ�Š�eÔ*¨GÔ,BÑCÔCÐCØ×Ò�.Ð*<Ð*<Ð*<Ð*<Ñ=Ô=Ð=Ð=Ð=r   c                 ó¼   — t          ¦   «         } t          t          ¦  «        |¦  «        }t          ¦   «         }||_        |                      |j        |¦  «         dS )zv
        The attributes that proxy objects proxy should be assignable and affect
        the original object.
        N)r,  r   r!  ru   r%  rp   ©r   rN  rI  Úthingys       r   Útest_proxySetAttributez-ProxyForInterfaceTests.test_proxySetAttributeË  sT   € õ
 ‘)”)ˆØ4Õ!Õ"3Ñ4Ô4°WÑ=Ô=ˆÝ‘”ˆØ%ˆÔØ�Š�gÔ,¨fÑ5Ô5Ð5Ð5Ð5r   c                 ó´   — t          ¦   «         }d|_         t          t          ¦  «        |¦  «        }|`|                      t          |d¦  «        ¦  «         dS )zu
        The attributes that proxy objects proxy should be deletable and affect
        the original object.
        Nr%  )r,  r%  r   r!  ÚassertFalseÚhasattrrY  s      r   Útest_proxyDeleteAttributez0ProxyForInterfaceTests.test_proxyDeleteAttributeÖ  sY   € õ
 ‘)”)ˆØ!%ˆÔØ4Õ!Õ"3Ñ4Ô4°WÑ=Ô=ˆØÐ Ø×Ò� Ð*:Ñ;Ô;Ñ<Ô<Ð<Ð<Ð<r   c                 óü   — t          ¦   «         } t          t          ¦  «        |¦  «        }|                      |                     ¦   «         d¦  «         |                      |                     ¦   «         d¦  «         dS )z€
        [Regression test] The proxy should send its method calls to the correct
        method, not the incorrect one.
        r   r`   N)rB  r   r;  rz   r=  r?  )r   ÚmultirI  s      r   Útest_multipleMethodsz+ProxyForInterfaceTests.test_multipleMethodsá  sn   € õ
 *Ñ+Ô+ˆØ3Õ!Õ"2Ñ3Ô3°EÑ:Ô:ˆØ×Ò˜ŸšÑ*Ô*¨AÑ.Ô.Ð.Ø×Ò˜ŸšÑ*Ô*¨AÑ.Ô.Ð.Ð.Ð.r   c                 ó  —  G d„ dt          t          ¦  «        ¦  «        }t          ¦   «         } ||¦  «        }|                      |j        d¦  «         |                     ¦   «          |                      |j        d¦  «         dS )zP
        It is possible to subclass the result of L{proxyForInterface}.
        c                   ó   — e Zd ZdZd„ ZdS )úAProxyForInterfaceTests.test_subclassing.<locals>.SpecializedProxyzU
            A specialized proxy which can decrement the number of yays.
            c                 ó0   — | j         xj        dz  c_        dS )z?
                Decrement the number of yays.
                r   N)r0   r.  r   s    r   r)  zEProxyForInterfaceTests.test_subclassing.<locals>.SpecializedProxy.booõ  s    € ð ”Ð"Ô" aÑ'Ð"Ô"Ð"Ð"r   Nr*  r   r   r   ÚSpecializedProxyrh  ð  s-   € € € € € ðð ð(ð (ð (ð (ð (r   rj  r   éÿÿÿÿN)r   r!  r,  rz   r.  r)  )r   rj  rN  Úspecials       r   Útest_subclassingz'ProxyForInterfaceTests.test_subclassingë  s”   € ð
		(ð 		(ð 		(ð 		(ð 		(Õ0Õ1BÑCÔCñ 		(ô 		(ð 		(õ ‘)”)ˆØ"Ð" 7Ñ+Ô+ˆØ×Ò˜œ qÑ)Ô)Ð)Ø�Š‰ŒˆØ×Ò˜œ rÑ*Ô*Ð*Ð*Ð*r   c                 ód   — t          t          ¦  «        }|                      |j        d¦  «         dS )zQ
        The name of a proxy class indicates which interface it proxies.
        zA(Proxy for twisted.python.test.test_components.IProxiedInterface)N)r   r!  rz   r   ©r   rI  s     r   Útest_proxyNamez%ProxyForInterfaceTests.test_proxyName  s<   € õ "Õ"3Ñ4Ô4ˆØ×ÒØŒNØRñ	
ô 	
ð 	
ð 	
ð 	
r   c                 óˆ   — t          t          ¦  «        }|                      t                               |¦  «        ¦  «         dS )zO
        The resulting proxy implements the interface that it proxies.
        N)r   r!  Ú
assertTrueÚimplementedByro  s     r   Útest_implementsz&ProxyForInterfaceTests.test_implements  s9   € õ "Õ"3Ñ4Ô4ˆØ�ŠÕ)×7Ò7¸Ñ>Ô>Ñ?Ô?Ð?Ð?Ð?r   c                 óP  —  G d„ d¦  «        } |¦   «         } |¦   «         }||_         t          j        dd¦  «        }|                      |                     |¦  «        |j        ¦  «         |                     d¦  «        } ||¦  «         |                      |j        ¦  «         dS )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                   ó   — e Zd ZdZd„ ZdS )ú>ProxyForInterfaceTests.test_proxyDescriptorGet.<locals>.SampleFc                 ó   — d| _         d S rî   )Úcalledr   s    r   rŒ   zDProxyForInterfaceTests.test_proxyDescriptorGet.<locals>.Sample.hello&  s   € Ø"�”��r   N)r   r   r   ry  rŒ   r   r   r   ÚSamplerw  #  s(   € € € € € ØˆFð#ð #ð #ð #ð #r   rz  rŒ   r0   N)r0   r   Ú_ProxyDescriptorrz   Ú__get__rŒ   rr  ry  )r   rz  Ú	fakeProxyÚ
testObjectÚpdÚfakeClassMethods         r   Útest_proxyDescriptorGetz.ProxyForInterfaceTests.test_proxyDescriptorGet  s½   € ð"	#ð 	#ð 	#ð 	#ð 	#ñ 	#ô 	#ð 	#ð �F‘H”Hˆ	Ø�V‘X”Xˆ
Ø'ˆ	ÔÝÔ(¨°*Ñ=Ô=ˆØ×Ò˜Ÿš IÑ.Ô.°
Ô0@ÑAÔAÐAØŸ*š* TÑ*Ô*ˆØˆ˜	Ñ"Ô"Ð"Ø�Š˜
Ô)Ñ*Ô*Ð*Ð*Ð*r   c                 óN  ‡—  G d„ dt          t          ¦  «        ¦  «        Š G ˆfd„d‰¦  «        }t          ¦   «         } ||¦  «        }|                      |                     dddd¬	¦  «        d
¦  «         |                      |j        dt          dd¬	¦  «        fg¦  «         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                   ó   — e Zd ZdZdS )úDProxyForInterfaceTests.test_proxyInheritance.<locals>.YayableWrapperzI
            This class does not override any functionality.
            N)r   r   r   rZ   r   r   r   ÚYayableWrapperr„  9  s   € € € € € ðð ð ð r   r…  c                   ó"   •— e Zd ZdZdZˆ fd„ZdS )úEProxyForInterfaceTests.test_proxyInheritance.<locals>.EnhancedWrapperz@
            This class overrides the 'yay' method.
            r   c                 óL   •— | xj         dz  c_          ‰j        | g|¢R i |¤Ždz   S )Nr   é   )ÚwrappedYaysr$  )r   r™   Úkr…  s      €r   r$  zIProxyForInterfaceTests.test_proxyInheritance.<locals>.EnhancedWrapper.yayE  s?   ø€ ØÐ Ô  AÑ%Ð Ô Ø)�~Ô)¨$Ð8°Ð8Ð8Ð8°aÐ8Ð8¸1Ñ<Ð<r   N)r   r   r   rZ   rŠ  r$  )r…  s   €r   ÚEnhancedWrapperr‡  >  s?   ø€ € € € € ðð ð ˆKð=ð =ð =ð =ð =ð =ð =r   rŒ  rÐ   é   é   é   )r·   Úyé   )rÐ   r�  N)r   r!  r,  rz   r$  r/  Údict)r   rŒ  rN  Úwrapperr…  s       @r   Útest_proxyInheritancez,ProxyForInterfaceTests.test_proxyInheritance2  sß   ø€ ð	ð 	ð 	ð 	ð 	Õ.Õ/@ÑAÔAñ 	ô 	ð 	ð
		=ð 		=ð 		=ð 		=ð 		=ð 		=ð 		=˜nñ 		=ô 		=ð 		=õ ‘)”)ˆØ!�/ 'Ñ*Ô*ˆØ×Ò˜Ÿš Q¨¨Q°!˜Ñ4Ô4°aÑ8Ô8Ð8Ø×Ò˜œ¨FµD¸1À°N±N´NÐ+CÐ*DÑEÔEÐEÐEÐEr   c                 ó  — t          t          ¦  «        }t          ¦   «         } ||¦  «        }|                     ¦   «          |                     ¦   «          |                      |j        ¦  «         |                      |j        ¦  «         dS )z 
        Proxies of subinterfaces generated with proxyForInterface should allow
        access to attributes of both the child and the base interfaces.
        N)r   r'  r4  r$  r)  rr  r6  r9  )r   Ú
proxyClassÚbooablerI  s       r   Útest_interfaceInheritancez0ProxyForInterfaceTests.test_interfaceInheritanceN  sr   € õ
 'Õ';Ñ<Ô<ˆ
Ý‘)”)ˆØ�
˜7Ñ#Ô#ˆØ�	Š	‰ŒˆØ�	Š	‰ŒˆØ�Š˜œÑ&Ô&Ð&Ø�Š˜œÑ&Ô&Ð&Ð&Ð&r   c                 óö  — t          ¦   «         }t          ¦   «         |_         t          t          d¬¦  «        |¦  «        }|                      |j        |¦  «         |                      |                     ¦   «         d¦  «         |                      |j        |j        ¦  «         t          ¦   «         }||_        |                      |j        |¦  «         |`|  	                    t          |d¦  «        ¦  «         dS )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)ÚoriginalAttributer   r%  N)r,  ru   r%  r   r!  rp   rš  rz   r$  r`  ra  r\  s       r   Útest_attributeCustomizationz2ProxyForInterfaceTests.test_attributeCustomization[  sÚ   € õ ‘)”)ˆÝ!'¡¤ˆÔØMÕ!Õ"3ÀuÐMÑMÔMÈgÑVÔVˆØ�Š�e”i Ñ)Ô)Ð)ð 	×Ò˜Ÿš™œ aÑ(Ô(Ð(Ø�Š�eÔ*¨GÔ,BÑCÔCÐCÝ‘”ˆØ%ˆÔØ�Š�gÔ,¨fÑ5Ô5Ð5ØÐ Ø×Ò� Ð*:Ñ;Ô;Ñ<Ô<Ð<Ð<Ð<r   N)r   r   r   rZ   rJ  rO  rU  rZ  r^  rb  re  rm  rp  rt  r�  r”  r˜  rœ  r   r   r   rG  rG  ”  s÷   € € € € € ðð ð0ð 0ð 0ð
*ð 
*ð 
*ð+ð +ð +ð$	>ð 	>ð 	>ð	6ð 	6ð 	6ð	=ð 	=ð 	=ð/ð /ð /ð+ð +ð +ð,
ð 
ð 
ð@ð @ð @ð+ð +ð +ð@Fð Fð Fð8'ð 'ð 'ð=ð =ð =ð =ð =r   rG  N);rZ   Ú	functoolsr   Úzope.interfacer   r   r   Úzope.interface.adapterr   Útwisted.pythonr   Útwisted.python.compatr	   r
   Útwisted.python.componentsr   r   r   Útwisted.trialr   rt   r   r    r&   r±   r,   r6   r9   r=   r?   rA   rC   rE   rG   rI   rN   rR   ÚSynchronousTestCaser\   r”   rœ   rž   r¦   r©   r¬   r¯   rµ   r»   r¿   rÃ   rË   rÕ   r!  r'  r,  r4  r;  rB  rG  r   r   r   ú<module>r¥     sß  ðð
ð ð
 Ð Ð Ð Ð Ð à <Ð <Ð <Ð <Ð <Ð <Ð <Ð <Ð <Ð <Ø 2Ð 2Ð 2Ð 2Ð 2Ð 2à %Ð %Ð %Ð %Ð %Ð %Ø 1Ð 1Ð 1Ð 1Ð 1Ð 1Ð 1Ð 1Ø NÐ NÐ NÐ NÐ NÐ NÐ NÐ NÐ NÐ NØ "Ð "Ð "Ð "Ð "Ð "ðð ð ð ð ˆJÔ$ñ ô ð ð$ð $ð $ð $ð $ˆYñ $ô $ð $ð
ð ð ð ð ˆyñ ô ð ð €ˆVÑÔð-ð -ð -ð -ð -ˆJÔñ -ô -ñ Ôð-ð €ˆXÑÔðð ð ð ð ˆjÔ ñ ô ñ Ôðð
	ð 	ð 	ð 	ð 	ˆJÔ$ñ 	ô 	ð 	ð	ð 	ð 	ð 	ð 	ˆEñ 	ô 	ð 	ð	ð 	ð 	ð 	ð 	ˆEñ 	ô 	ð 	ð	ð 	ð 	ð 	ð 	ˆIñ 	ô 	ð 	ð	ð 	ð 	ð 	ð 	ˆYñ 	ô 	ð 	ð	ð 	ð 	ð 	ð 	ˆYñ 	ô 	ð 	ð	ð 	ð 	ð 	ð 	ˆYñ 	ô 	ð 	ð €ˆU�F˜FÑ#Ô#ðð ð ð ð ˆ:Ôñ ô ñ $Ô#ðð
 €ˆVÑÔðð ð ð ð ñ ô ñ Ôðð+ð +ð +ð +ð +ñ +ô +ð +ð*i'ð i'ð i'ð i'ð i'˜Ô5Ð7Iñ i'ô i'ð i'ðX*ð *ð *ð *ð *�8Ô/ñ *ô *ð *ð	ð 	ð 	ð 	ð 	ˆIñ 	ô 	ð 	ð €ˆUÑÔð'ð 'ð 'ð 'ð '�
Ô"ñ 'ô 'ñ Ôð'ð
 €ˆUÑÔð'ð 'ð 'ð 'ð '�ZÔ'ñ 'ô 'ñ Ôð'ð
ð ð ð ð ñ ô ð ð0ð 0ð 0ð 0ð 0�jÔ.ñ 0ô 0ð 0ð €ˆUÑÔðð ð ð ð �ZÔ'ñ ô ñ Ôððð ð ð ð ˆYñ ô ð ðð ð ð ð ˆiñ ô ð ð €ˆVÑÔðð ð ð ð ñ ô ñ Ôðð ð(ð (ð (ð (ð (ñ (ô (ñ „ð(ð"0ð 0ð 0ð 0ð 0Ð+¨XÔ-Iñ 0ô 0ð 0ð.yLð yLð yLð yLð yLÐ*¨HÔ,Hñ yLô yLð yLðxð ð ð ð ˜	ñ ô ð ð ð ð ð ð Ð,ñ ô ð ð €ÐÑÔðð ð ð ð ñ ô ñ  Ôðð. €Ð!Ñ"Ô"ðð ð ð ð ñ ô ñ #Ô"ðð.ð ð ð ð �yñ ô ð ð ð ð ð ð ñ ô ð ð$Z=ð Z=ð Z=ð Z=ð Z=˜XÔ9ñ Z=ô Z=ð Z=ð Z=ð Z=r   