[issue41877] Check against misspellings of assert etc. in mock

Václav Brožek report at bugs.python.org
Thu Dec 10 04:45:01 EST 2020


Václav Brožek <vabr at google.com> added the comment:

https://github.com/python/cpython/pull/23729 is now a follow-up to improve docs and error message about the assert misspellings.

I'm now looking at the misspelled arguments: autospec and spec_set. These are accepted by patch, patch.object and patch.multiple, and spec_set is also accepted by create_autospec.

The three frequent misspellings I saw in our codebase are auto_spec, autospect and set_spec. I could add a check to look for them in kwargs, and also add an "unsafe" argument (default False), which, when True, disables the check. This would mimic what is already done for the misspelled asserts.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue41877>
_______________________________________


More information about the Python-bugs-list mailing list