
    Of-                         d Z ddlZd Z G d dej                  Z G d dej                  Zd Z G d	 d
ej                  Z G d dej                  ZdS )z& zope.interface.exceptions unit tests
    Nc                  .    ddl m}   G d d|           }|S )Nr   )	Interfacec                       e Zd ZdS )_makeIface.<locals>.IDummyN)__name__
__module____qualname__     V/var/www/html/env/lib/python3.11/site-packages/zope/interface/tests/test_exceptions.pyIDummyr      s        r   r   )zope.interfacer   )r   r   s     r   
_makeIfacer      sE    ((((((        Mr   c                   &    e Zd Zd Zd Zd Zd ZdS )DoesNotImplementTestsc                     ddl m} |S )Nr   )DoesNotImplement)zope.interface.exceptionsr   )selfr   s     r   _getTargetClassz%DoesNotImplementTests._getTargetClass   s    >>>>>>r   c                 T    t                      } |                                 |g|R  S )Nr   r   r   argsifaces      r   _makeOnezDoesNotImplementTests._makeOne"   s/    %t##%%e3d3333r   c                 t    |                                  }|                     t          |          d           d S )NzAn object has failed to implement interface zope.interface.tests.test_exceptions.IDummy: Does not declaratively implement the interface.r   assertEqualstrr   dnis     r   test___str__z"DoesNotImplementTests.test___str__&   s?    mmooHH>	
 	
 	
 	
 	
r   c                 v    |                      d          }|                     t          |          d           d S )N	candidatezThe object 'candidate' has failed to implement interface zope.interface.tests.test_exceptions.IDummy: Does not declaratively implement the interface.r   r!   s     r   test___str__w_candidatez-DoesNotImplementTests.test___str__w_candidate/   sC    mmK((HH>	
 	
 	
 	
 	
r   Nr   r   r	   r   r   r#   r&   r
   r   r   r   r      sP             4 4 4
 
 

 
 
 
 
r   r   c                   &    e Zd Zd Zd Zd Zd ZdS )BrokenImplementationTestsc                     ddl m} |S )Nr   )BrokenImplementation)r   r+   )r   r+   s     r   r   z)BrokenImplementationTests._getTargetClass;   s    BBBBBB##r   c                 V    t                      } |                                 |dg|R  S )Nmissingr   r   s      r   r   z"BrokenImplementationTests._makeOne?   s1    %t##%%eY>>>>>r   c                 t    |                                  }|                     t          |          d           d S )NzAn object has failed to implement interface zope.interface.tests.test_exceptions.IDummy: The 'missing' attribute was not provided.r   r!   s     r   r#   z&BrokenImplementationTests.test___str__C   s?    mmooHH8	9 	9 	9 	9 	9r   c                 v    |                      d          }|                     t          |          d           d S )Nr%   zThe object 'candidate' has failed to implement interface zope.interface.tests.test_exceptions.IDummy: The 'missing' attribute was not provided.r   r!   s     r   r&   z1BrokenImplementationTests.test___str__w_candidateK   sC    mmK((HH8	9 	9 	9 	9 	9r   Nr'   r
   r   r   r)   r)   9   sP        $ $ $? ? ?9 9 99 9 9 9 9r   r)   c                      dS )z
    This is a global function with a simple argument list.

    It exists to be able to report the same information when
    formatting signatures.
    Nr
   r
   r   r   broken_functionr1   T   s      r   c                   <    e Zd Zd ZdZd Zd Zd Zd Zd Z	d Z
d	S )
BrokenMethodImplementationTestsc                     ddl m} |S )Nr   BrokenMethodImplementation)r   r6   )r   r6   s     r   r   z/BrokenMethodImplementationTests._getTargetClass_   s    HHHHHH))r   	I said soc                 D     |                                  d| j        g|R  S )NaMethod)r   message)r   r   s     r   r   z(BrokenMethodImplementationTests._makeOnee   s*    %t##%%iEEEEEr   c                 t    |                                  }|                     t          |          d           d S )NzoAn object has failed to implement interface <Unknown>: The contract of 'aMethod' is violated because I said so.r   r!   s     r   r#   z,BrokenMethodImplementationTests.test___str__h   s@    mmooHHG	
 	
 	
 	
 	
r   c                 z    |                      ddd          }|                     t          |          d           d S )Nsome_function<IFoo>r%   zyThe object 'candidate' has failed to implement interface <IFoo>: The contract of 'aMethod' is violated because I said so.r   r!   s     r   )test___str__w_candidate_no_implementationzIBrokenMethodImplementationTests.test___str__w_candidate_no_implementationp   sH    mmOX{CCHHG	
 	
 	
 	
 	
r   c                     d| _         |                     t          dd          }|                     t	          |          d           d S )Nzimplementation is wonkyr>   r%   zThe object 'candidate' has failed to implement interface <IFoo>: The contract of 'aMethod' is violated because 'broken_function()' is wonky.)r:   r   r1   r   r    r!   s     r   (test___str__w_candidate_w_implementationzHBrokenMethodImplementationTests.test___str__w_candidate_w_implementationx   sN    0mmOX{CCHH,	
 	
 	
 	
 	
r   c                     d| _         |                     ddd          }|                     t          |          d           d S )Nzimplementation is not callable*   r>   r%   zThe object 'candidate' has failed to implement interface <IFoo>: The contract of 'aMethod' is violated because '42' is not callable.)r:   r   r   r    r!   s     r   5test___str__w_candidate_w_implementation_not_callablezUBrokenMethodImplementationTests.test___str__w_candidate_w_implementation_not_callable   sN    7mmB+66HH$	
 	
 	
 	
 	
r   c                 x    |                      d d          }|                     t          |          d           d S )Nr%   zEBrokenMethodImplementation('aMethod', 'I said so', None, 'candidate'))r   r   reprr!   s     r   test___repr__w_candidatez8BrokenMethodImplementationTests.test___repr__w_candidate   sE    mmD+..II9	
 	
 	
 	
 	
r   N)r   r   r	   r   r:   r   r#   r?   rA   rD   rG   r
   r   r   r3   r3   ]   s        * * * GF F F
 
 

 
 

 
 

 
 

 
 
 
 
r   r3   c                   &    e Zd Zd Zd Zd Zd ZdS )MultipleInvalidTestsc                     ddl m} |S )Nr   )MultipleInvalid)r   rK   )r   rK   s     r   r   z$MultipleInvalidTests._getTargetClass   s    ======r   c                 \    t                      } |                                 |d|          S )Ntargetr   )r   excsr   s      r   r   zMultipleInvalidTests._makeOne   s+    %t##%%eXt<<<r   c                     ddl m}  |dd          t          d          g}|                     |          }|                     t          |          d           d S )Nr   r5   r9   r7   zRegular exceptionzThe object 'target' has failed to implement interface zope.interface.tests.test_exceptions.IDummy:
    The contract of 'aMethod' is violated because I said so
    Regular exception)r   r6   	Exceptionr   r   r    r   r6   rN   r"   s       r   test__str__z MultipleInvalidTests.test__str__   sz    HHHHHH&&y+>>)**
 mmD!!HH$	
 	
 	
 	
 	
r   c                     ddl m}  |dd          t          dd          g}|                     |          }|                     t          |          d           d S )Nr   r5   r9   r7   Regular	exceptionzMultipleInvalid(<InterfaceClass zope.interface.tests.test_exceptions.IDummy>, 'target', (BrokenMethodImplementation('aMethod', 'I said so'), Exception('Regular', 'exception'))))r   r6   rP   r   r   rF   rQ   s       r   test__repr__z!MultipleInvalidTests.test__repr__   s}    HHHHHH&&y+>> i--	
 mmD!!II3	
 	
 	
 	
 	
r   N)r   r   r	   r   r   rR   rV   r
   r   r   rI   rI      sP          = = =
 
 

 
 
 
 
r   rI   )	__doc__unittestr   TestCaser   r)   r1   r3   rI   r
   r   r   <module>rZ      s       
 
 
 
 
H- 
 
 
:9 9 9 9 9 1 9 9 96  5
 5
 5
 5
 5
h&7 5
 5
 5
p)
 )
 )
 )
 )
8, )
 )
 )
 )
 )
r   