def test_get_dict_func_getter_callable(self): f = get_dict_func_getter({}) self.assertAlmostEqual(f(lambda x: x)(3), 3)
def test_get_dict_func_getter(self): f = get_dict_func_getter({'norm': lambda x: x}) self.assertAlmostEqual(f('norm')(3), 3)
def test_get_dict_func_getter_fails(self): f = get_dict_func_getter({}) with self.assertRaises(KeyError): self.assertAlmostEqual(f('not_real')(3), 0.00)