Description
Right now test_inspect
uses several hacks to pretend that some parameters are positional only:
cpython/Lib/test/test_inspect.py
Lines 2465 to 2469 in ecad802
cpython/Lib/test/test_inspect.py
Lines 2519 to 2522 in ecad802
cpython/Lib/test/test_inspect.py
Lines 3047 to 3052 in ecad802
cpython/Lib/test/test_inspect.py
Lines 3559 to 3565 in ecad802
cpython/Lib/test/test_inspect.py
Lines 4160 to 4166 in ecad802
And maybe others.
It makes code more complex, unclear, and hides the real purpose of these tests.
This is not a design decision, but rather a limitation at the time. Commits are quite old and pos-only syntax was not available 9 and 11 years ago:
So, I propose to simplify these tests and make them more correct by using explicit pos only parameters.
Plus, we can keep one test like this to be sure that chaning a parameter kind still works as before. But, there's no need in keeping these old tests the way they are.
I will send a PR with the fix 👍