def test_it_raises_attributeError_when_key_doesnt_exist(self): config_util = ConfigUtil() config_util.values = {"a":1} config_util.find_value("a") |should| be(1) finder = lambda : config_util.find_value("b") finder |should| throw(AttributeError, "Config has no value for b")
def test_it_returns_value_as_is(self): val = fudge.Fake("val") config_util = ConfigUtil() config_util.values = {"c":val} config_util.find_value("c") |should| be(val)
def test_it_returns_actual_value_if_finds_default(self): config_util = ConfigUtil() config_util.values = {"a":Default(21)} config_util.find_value("a") |should| be(21)