def test_getitem_delegates_to_subconfigs(self): arg_config = {"number 5": "is alive"} env_config = {"number 5": "is DEEEAAAADD"} file_config = {"number 7": "I am"} config = MetaConfig(include_arg_config=True) config._argument_config = arg_config config._env_config = env_config config._file_config = file_config eq_(config["number 5"], "is alive") eq_(config["number 7"], "I am")
def test_nonexistent_items_cause_an_error(self): config = MetaConfig([]) config._argument_config = {} config._env_config = {} config._file_config = {} try: config["rausch"] except KeyError as e: eq_( e.message, "Couldn't find any setting at all for 'rausch'. " "You'll need to supply it in some way--try `catsnap " "config`, or see the docs for other ways to supply " "a setting.", ) else: raise AssertionError("this test shoulda thrown")