def test_construct_method_map_dict(self): """ Tests that the construct_method_map works with a dict """ dispatcher = Dispatcher() dispatcher.construct_method_map(METHOD_MAP) self.assertDictEqual(METHOD_MAP, dispatcher.method_handlers, "Method map was not constructed properly")
def test_constr_method_map_prefix(self): """ Tests that the construct_method_map works with a prefix """ dispatcher = Dispatcher() dispatcher.construct_method_map(METHOD_MAP, prefix="prefix.") method_map = {("prefix." + k): v for k, v in METHOD_MAP.items()} self.assertDictEqual(method_map, dispatcher.method_handlers, "Method map was not constructed properly")
def test_construct_method_map_class(self): """ Tests that the construct_method_map works with a class """ dispatcher = Dispatcher() dispatcher.construct_method_map(MethodMapClass) self.assertDictEqual( {"test1": MethodMapClass.test1, "test2": MethodMapClass.test2}, dispatcher.method_handlers, "Method map was not constructed properly", )
def test_construct_method_map_obj(self): """ Tests that the construct_method_map works with an object """ method_map = MethodMapObject() dispatcher = Dispatcher() dispatcher.construct_method_map(method_map) self.assertDictEqual( {"test1": method_map.test1, "test2": method_map.test2}, dispatcher.method_handlers, "Method map was not constructed properly", )