
    (ph                         S SK Jr   " S S5      r " S S5      r " S S5      r S SKJr  \R                  rg! \ a     " S	 S
5      r gf = f)    )_should_attempt_c_optimizationsc                   *    \ rS rSrSrS rS rS rSrg)OptimizationTestMixin   zBMixin testing that C optimizations are used when appropriate.
    c                     [         e)zMReturn the implementation in use, without 'Py' or 'Fallback' suffix.
        NotImplementedErrorselfs    P/var/www/html/venv/lib/python3.13/site-packages/zope/interface/tests/__init__.py_getTargetClass%OptimizationTestMixin._getTargetClass   
     "!    c                     [         e)z3Return the fallback Python implementation.
        r   r
   s    r   _getFallbackClass'OptimizationTestMixin._getFallbackClass   s
     "!r   c                     U R                  5       nU R                  5       n[        5       (       a  U R                  X5        g U R	                  X5        g N)r   r   r   assertIsNotassertIs)r   usedfallbacks      r   test_optimizations(OptimizationTestMixin.test_optimizations   sA    ##%))+*,,T,MM$)r    N)	__name__
__module____qualname____firstlineno____doc__r   r   r   __static_attributes__r   r   r   r   r      s    "
"*r   r   c                        \ rS rSrS rS rSrg)SubclassableMixin   c                     [         e)zLReturn the implementation in use without 'Py' or 'Fallback' suffix.
        r   r
   s    r   r   !SubclassableMixin._getTargetClass!   r   r   c                 :    U R                  5       n " S SU5      ng )Nc                       \ rS rSrSrg)4SubclassableMixin.test_can_subclass.<locals>.Derived)   r   N)r   r   r   r    r"   r   r   r   Derivedr*   )   s    r   r,   )r   )r   klassr,   s      r   test_can_subclass#SubclassableMixin.test_can_subclass&   s    $$&	e 	r   r   N)r   r   r   r    r   r.   r"   r   r   r   r$   r$      s    "
r   r$   c                   @    \ rS rSrSrS rS r\\\	\
4r\S 5       rSrg)MissingSomeAttrs-   z
Helper for tests that raises a specific exception
for attributes that are missing. This is usually not
an AttributeError, and this object is used to test that
those errors are not improperly caught and treated like
an AttributeError.
c                 ^    Xl         [        R                  U S5      nUR                  U5        g )N__dict__)_MissingSomeAttrs__exc_kindobject__getattribute__update)r   exc_kindother_attrsds       r   __init__MissingSomeAttrs.__init__6   s%    "##D*5	r   c                 j    [         R                  U S5      n X!   $ ! [         a    US   " U5      ef = f)Nr4   r5   )r6   r7   KeyError)r   namer;   s      r   r7   !MissingSomeAttrs.__getattribute__;   s@    ##D*5	97N 	912488	9s    2c                    [        U[        5      (       d   eX4;  d   eU R                   HW  nU " U40 UD6nUR                  U5       nU" U5        SSS5        UR	                  WR
                  R                  S   U5        MY     U " [        40 UD6n U" U5        g! , (       d  f       NR= f! [         a%  nUR                  U[        U5      5         SnAgSnAf[         a     gf = f)a  
Loop through various exceptions, calling *test_func* inside a
``assertRaises`` block.

:param test_func: A callable of one argument, the instance of this
    class.
:param str expected_missing: The attribute that should fail with the
    exception.  This is used to ensure that we're testing the path we
    think we are.
:param other_attrs: Attributes that should be provided on the test
    object.  Must not contain *expected_missing*.
Nr   )

isinstancestrEXCEPTION_CLASSESassertRaisesassertEqual	exceptionargsAttributeErrorassertNotIn	Exception)	clsunittest	test_funcexpected_missingr:   excobexes	            r   test_raisesMissingSomeAttrs.test_raisesJ   s     *C0000222((CS(K(B&&s+r" ,   !2!21!57GH ) /;/	bM ,+  	;  !13q6:: 		s*   	BB. 
B+	.
C(8CC('C()
__exc_kindN)r   r   r   r    r!   r<   r7   	TypeErrorRuntimeErrorBaseException
ValueErrorrE   classmethodrU   r"   r   r   r   r1   r1   -   s;    
9 		  r   r1   )cleanupc                   "    \ rS rSrS r\=rrSrg)CleanUp|   c                     g r   r   r
   s    r   cleanUpCleanUp.cleanUp}   s    r   r   N)r   r   r   r    rb   setUptearDownr"   r   r   r   r_   r_   |   s    	 #"r   r_   N)	zope.interface._compatr   r   r$   r1   zope.testingr]   r_   ImportErrorr   r   r   <module>ri      sU    B* *6 < <V
$ ooG  ## ##s   9 AA