e dZddlZdZGddejZGddejZdZGd d ejZGd d ejZy) z& zope.interface.exceptions unit tests Nc(ddlm}Gdd|}|S)Nr) Interfacec eZdZy)_makeIface..IDummyN)__name__ __module__ __qualname__F/usr/lib/python3/dist-packages/zope/interface/tests/test_exceptions.pyIDummyrs r r )zope.interfacer)rr s r _makeIfacers(  Mr c$eZdZdZdZdZdZy)DoesNotImplementTestscddlm}|S)Nr)DoesNotImplement)zope.interface.exceptionsr)selfrs r _getTargetClassz%DoesNotImplementTests._getTargetClasss >r cDt}|j|g|S)Nrrrargsifaces r _makeOnezDoesNotImplementTests._makeOnes$ %t##%e3d33r cZ|j}|jt|dy)NzAn object has failed to implement interface zope.interface.tests.test_exceptions.IDummy: Does not declaratively implement the interface.r assertEqualstrrdnis r test___str__z"DoesNotImplementTests.test___str__"s'mmo  H > r c\|jd}|jt|dy)N candidatezThe object 'candidate' has failed to implement interface zope.interface.tests.test_exceptions.IDummy: Does not declaratively implement the interface.rr!s r test___str__w_candidatez-DoesNotImplementTests.test___str__w_candidate+s*mmK(  H > r Nrrr rrr#r&r r r rrs 4  r rc$eZdZdZdZdZdZy)BrokenImplementationTestscddlm}|S)Nr)BrokenImplementation)rr+)rr+s r rz)BrokenImplementationTests._getTargetClass7s B##r cFt}|j|dg|S)Nmissingrrs r rz"BrokenImplementationTests._makeOne;s& %t##%eY>>>r cZ|j}|jt|dy)NzAn object has failed to implement interface zope.interface.tests.test_exceptions.IDummy: The 'missing' attribute was not provided.rr!s r r#z&BrokenImplementationTests.test___str__?s'mmo  H 8 9r c\|jd}|jt|dy)Nr%zThe object 'candidate' has failed to implement interface zope.interface.tests.test_exceptions.IDummy: The 'missing' attribute was not provided.rr!s r r&z1BrokenImplementationTests.test___str__w_candidateGs*mmK(  H 8 9r Nr'r r r r)r)5s$?99r r)cy)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_functionr1Psr c:eZdZdZdZdZdZdZdZdZ dZ y ) BrokenMethodImplementationTestscddlm}|S)NrBrokenMethodImplementation)rr6)rr6s r rz/BrokenMethodImplementationTests._getTargetClass[s H))r I said socF|jd|jg|S)NaMethod)rmessage)rrs r rz(BrokenMethodImplementationTests._makeOneas#%t##%iEEEr cZ|j}|jt|dy)NzoAn object has failed to implement interface : The contract of 'aMethod' is violated because I said so.rr!s r r#z,BrokenMethodImplementationTests.test___str__ds(mmo  H G r c`|jddd}|jt|dy)N some_functionr%zyThe object 'candidate' has failed to implement interface : The contract of 'aMethod' is violated because I said so.rr!s r )test___str__w_candidate_no_implementationzIBrokenMethodImplementationTests.test___str__w_candidate_no_implementationls/mmOX{C  H G r cvd|_|jtdd}|jt |dy)Nzimplementation is wonkyr>r%zThe object 'candidate' has failed to implement interface : The contract of 'aMethod' is violated because 'broken_function()' is wonky.)r:rr1rr r!s r (test___str__w_candidate_w_implementationzHBrokenMethodImplementationTests.test___str__w_candidate_w_implementationts50 mmOX{C  H , r cnd|_|jddd}|jt|dy)Nzimplementation is not callable*r>r%zThe object 'candidate' has failed to implement interface : The contract of 'aMethod' is violated because '42' is not callable.)r:rrr r!s r 5test___str__w_candidate_w_implementation_not_callablezUBrokenMethodImplementationTests.test___str__w_candidate_w_implementation_not_callable~s57 mmB+6  H $ r c^|jdd}|jt|dy)Nr%zEBrokenMethodImplementation('aMethod', 'I said so', None, 'candidate'))rrreprr!s r test___repr__w_candidatez8BrokenMethodImplementationTests.test___repr__w_candidates*mmD+.  I S r N) rrr rr:rr#r?rArDrGr r r r3r3Ys-*GF     r r3c$eZdZdZdZdZdZy)MultipleInvalidTestscddlm}|S)Nr)MultipleInvalid)rrK)rrKs r rz$MultipleInvalidTests._getTargetClasss =r cFt}|j|d|S)Ntargetr)rexcsrs r rzMultipleInvalidTests._makeOnes# %t##%eXt< ) * mmD!  H $ r cddlm}|ddtddg}|j|}|j t |dy)Nrr5r9r7Regular exceptionzMultipleInvalid(, 'target', (BrokenMethodImplementation('aMethod', 'I said so'), Exception('Regular', 'exception'))))rr6rPrrrFrQs r test__repr__z!MultipleInvalidTests.test__repr__sLH &y+ > i -   mmD!  I 3 r N)rrr rrrRrVr r r rIrIs=   r rI) __doc__unittestrTestCaserr)r1r3rIr r r rZs`  H-- :9 1 1964 h&7&74 n( 8,,( r