
    i_                         d Z ddlZddlZ G d dej        j                  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                       e Zd ZdS )IDummyN)__name__
__module____qualname__     O/usr/local/lib/python3.11/dist-packages/zope/interface/tests/test_exceptions.pyr   r      s        Dr	   r   c                      ddl m}  | S )Nr   r   )$zope.interface.tests.test_exceptionsr   r   s    r
   
_makeIfacer      s    ;;;;;;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_candidate2   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._makeOneB   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__F   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_candidateN   sC    mmK((HH8	9 	9 	9 	9 	9r	   Nr&   r   r	   r
   r(   r(   <   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_functionr0   W   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   r5   )r   r5   s     r
   r   z/BrokenMethodImplementationTests._getTargetClassb   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._makeOneh   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__k   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_implementations   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.)r9   r   r0   r   r   r    s     r
   (test___str__w_candidate_w_implementationzHBrokenMethodImplementationTests.test___str__w_candidate_w_implementation{   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.)r9   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   r9   r   r"   r>   r@   rC   rF   r   r	   r
   r2   r2   `   s        * * * GF F F
 
 

 
 

 
 

 
 

 
 
 
 
r	   r2   c                   &    e Zd Zd Zd Zd Zd ZdS )MultipleInvalidTestsc                     ddl m} |S )Nr   )MultipleInvalid)r   rJ   )r   rJ   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   r4   r8   r6   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   r5   	Exceptionr   r   r   r   r5   rM   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   r4   r8   r6   Regular	exceptionzMultipleInvalid(<InterfaceClass zope.interface.tests.test_exceptions.IDummy>, 'target', (BrokenMethodImplementation('aMethod', 'I said so'), Exception('Regular', 'exception'))))r   r5   rO   r   r   rE   rP   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   rQ   rU   r   r	   r
   rH   rH      sP          = = =
 
 

 
 
 
 
r	   rH   )__doc__unittestzope.interfacezope	interface	Interfacer   r   TestCaser   r(   r0   r2   rH   r   r	   r
   <module>r]      s0        	 	 	 	 	T^% 	 	 	  
 
 
 
 
H- 
 
 
:9 9 9 9 9 1 9 9 96  5
 5
 5
 5
 5
h&7 5
 5
 5
p)
 )
 )
 )
 )
8, )
 )
 )
 )
 )
r	   