Backport tests from `test_typing.py` (#1028)

As promised in https://bugs.python.org/issue46386

Backported:
- https://github.com/python/cpython/pull/30619

Not backported:
- https://github.com/python/cpython/pull/30613 (because `ParamSpec` is already tested with `pickle` using all protocols)
1 file changed