MCPcopy Index your code
hub / github.com/pyinvoke/invoke / attr_access_has_useful_error_msg

Method attr_access_has_useful_error_msg

tests/config.py:238–252  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

236 assert c["biz"].baz == "boz"
237
238 def attr_access_has_useful_error_msg(self):
239 c = Config()
240 try:
241 c.nope
242 except AttributeError as e:
243 expected = """
244No attribute or config key found for 'nope'
245
246Valid keys: ['run', 'runners', 'sudo', 'tasks', 'timeouts']
247
248Valid real attributes: ['clear', 'clone', 'env_prefix', 'file_prefix', 'from_data', 'global_defaults', 'load_base_conf_files', 'load_collection', 'load_defaults', 'load_overrides', 'load_project', 'load_runtime', 'load_shell_env', 'load_system', 'load_user', 'merge', 'pop', 'popitem', 'prefix', 'set_project_location', 'set_runtime_path', 'setdefault', 'update']
249""".strip() # noqa
250 assert str(e) == expected
251 else:
252 assert False, "Didn't get an AttributeError on bad key!"
253
254 def subkeys_get_merged_not_overwritten(self):
255 # Ensures nested keys merge deeply instead of shallowly.

Callers

nothing calls this directly

Calls 2

ConfigClass · 0.90
strClass · 0.85

Tested by

no test coverage detected