def test_unregister_call_again(self): from typecheck import typecheck_args, unregister_type, TypeCheckError, _TC_IndexError from typecheck import _TC_TypeError @typecheck_args(5, 6) def foo(a, b): return a, b assert foo(5, 6) == (5, 6) unregister_type(self.ExactValue) try: foo('a', 5) except TypeCheckError, e: assert isinstance(e.internal, _TC_TypeError) assert e.internal.wrong == str assert e.internal.right == 5
def test_unregister_def(self): from typecheck import register_type, typecheck_args from typecheck import unregister_type @typecheck_args(5, 6) def foo(a, b): return a, b assert foo(5, 6) == (5, 6) unregister_type(self.ExactValue) try: @typecheck_args(5, 6) def foo(a, b): return a, b except AssertionError: pass else: raise AssertionError("Succeeded incorrectly")
def tearDown(self): from typecheck import unregister_type unregister_type(self.UIM)
def tearDown(self): from typecheck import unregister_type, is_registered_type if is_registered_type(self.ExactValue): unregister_type(self.ExactValue)
def tearDown(self): from typecheck import unregister_type unregister_type(self.UIM)