G_ TddlmZmZmZmZddlmZGddeZGddeZ y))AnyCallableOptionalType)TestCaseceZdZdZ ddZy)HyperlinkTestCaseznThis type mostly exists to provide a backwards-compatible assertRaises method for Python 2.6 testing. Ncbt||}||S|5||i|dddy#1swYyxYw)aFail unless an exception of class expected_exception is raised by callableObj when invoked with arguments args and keyword arguments kwargs. If a different type of exception is raised, it will not be caught, and the test case will be deemed to have suffered an error, exactly as for an unexpected exception. If called with callableObj omitted or None, will return a context object used like this:: with self.assertRaises(SomeException): do_something() The context manager keeps a reference to the exception as the 'exception' attribute. This allows you to inspect the exception after the assertion:: with self.assertRaises(SomeException) as cm: do_something() the_exception = cm.exception self.assertEqual(the_exception.error_code, 3) N)_AssertRaisesContext)selfexpected_exception callableObjargskwargscontexts 7/usr/lib/python3/dist-packages/hyperlink/test/common.py assertRaiseszHyperlinkTestCase.assertRaises sA<''94@  N  )  ( ( ) ) )s %.N)__name__ __module__ __qualname____doc__rrr r s")rr c"eZdZdZdZdZdZy)r zCA context manager used to implement HyperlinkTestCase.assertRaises.c4||_|j|_yr)expectedfailureException)r r test_cases r__init__z_AssertRaisesContext.__init__2s  ) : :rc|Srr)r s r __enter__z_AssertRaisesContext.__enter__7s rc|*|jj}|j|dt||jsy||_y)Nz not raisedFT)rrr issubclass exception)r exc_type exc_valuetbexc_names r__exit__z_AssertRaisesContext.__exit__;sF  }}--H''8(EF F(DMM2"rN)rrrrr r"r*rrrr r /sI;  rr N) typingrrrrunittestrr objectr rrrr.s'00')')T6r