def test_instance_method(self): invoker = FunctionInvoker() a = A([]) invoker.provide_callable(lambda : [], provide_type=list) invoker.provide_callable(a.test_dict_1, invoker=invoker) self.assertIsInstance(invoker.invoke(a.test_dict_2), dict)
def test_create_instance_deep_miss_A_arg(self): invoker = FunctionInvoker() invoker.provide_callable(A, provide_type=A) with self.assertRaises(TypeError): self.assertIsInstance(invoker.invoke(func5), A)
def test_create_instance_miss_type(self): with self.assertRaises(TypeError): invoker = FunctionInvoker() invoker.provide_callable(lambda : [])
def test_create_instance_deep(self): invoker = FunctionInvoker() invoker.provide_callable(lambda : [], provide_type=list) invoker.provide_callable(A, provide_type=A, invoker=invoker) self.assertIsInstance(invoker.invoke(func5), A)
def test_create_instance(self): invoker = FunctionInvoker() invoker.provide_callable(lambda : [], provide_type=list) self.assertIsInstance(invoker.invoke(func4), list)