HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //lib/python3/dist-packages/zope/interface/tests/__pycache__/__init__.cpython-310.pyc
o

$
x`��@slddlmZGdd�de�ZGdd�de�ZzddlmZWney0Gdd�de�ZYd	SwejZd	S)
�)�_should_attempt_c_optimizationsc@s(eZdZdZdd�Zdd�Zdd�ZdS)	�OptimizationTestMixinzP
    Helper for testing that C optimizations are used
    when appropriate.
    cC�t�)zq
        Define this to return the implementation in use,
        without the 'Py' or 'Fallback' suffix.
        ��NotImplementedError��self�r	�?/usr/lib/python3/dist-packages/zope/interface/tests/__init__.py�_getTargetClass
sz%OptimizationTestMixin._getTargetClasscCr)zK
        Define this to return the fallback Python implementation.
        rrr	r	r
�_getFallbackClasssz'OptimizationTestMixin._getFallbackClasscCs6|��}|��}t�r|�||�dS|�||�dS�N)rrr�assertIsNot�assertIs)r�used�fallbackr	r	r
�test_optimizationss
z(OptimizationTestMixin.test_optimizationsN)�__name__�
__module__�__qualname__�__doc__rrrr	r	r	r
rs
	rc@s8eZdZdZdd�Zdd�Zeeee	fZ
edd��ZdS)	�MissingSomeAttrsa
    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.
    cKs ||_t�|d�}|�|�dS)N�__dict__)�_MissingSomeAttrs__exc_kind�object�__getattribute__�update)r�exc_kind�other_attrs�dr	r	r
�__init__-szMissingSomeAttrs.__init__cCs2t�|d�}z||WSty|d|��w)Nrr)rr�KeyError)r�namerr	r	r
r2s
�z!MissingSomeAttrs.__getattribute__c	
Ks�t|t�sJ�||vs
J�|jD]-}||fi|��}|�|��}||�Wd�n1s.wY|�|jjd|�q|tfi|��}z||�WdStyh}z|�|t|��WYd}~dSd}~wt	yqYdSw)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�er	r	r
�test_raisesAs"

���zMissingSomeAttrs.test_raisesN)
rrrrr r�	TypeError�RuntimeError�
BaseException�
ValueErrorr%�classmethodr5r	r	r	r
r$s	�r)�cleanupc@seZdZdd�ZeZZdS)�CleanUpcCsdSr
r	rr	r	r
�cleanUpnszCleanUp.cleanUpN)rrrr=�setUp�tearDownr	r	r	r
r<msr<N)	�zope.interface._compatrrrr�zope.testingr;�ImportErrorr<r	r	r	r
�<module>s F�