WebOb: Add urljoin - #16135
Conversation
This comment has been minimized.
This comment has been minimized.
srittau
left a comment
There was a problem hiding this comment.
Please remove the tests. In typeshed, we only add regression tests for functions and classes which are known to have caused complex problems in the past, or where stubs are difficult to get right. 100% test coverage for typeshed is neither necessary nor desirable, as it would lead to code duplication.
See tests/REGRESSION.md for more information.
| @overload | ||
| def urljoin(base: None, url: str) -> str: ... | ||
| @overload | ||
| def urljoin(base: None, url: None) -> None: ... |
There was a problem hiding this comment.
urllib's urljoin doesn't allow a None base so we shouldn't either.
There was a problem hiding this comment.
Updated: the base is now typed as str, and I removed the regression tests as requested. WebOb stubtest and the file-scoped pre-commit checks pass.
3cfb86d to
c124ff5
Compare
|
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
|
Sorry, I forgot to mention that in the earlier PR, but we should also bump the version of WebOb to |
Closes #16134.
WebOb 1.8.11 added
webob.util.urljoinas its own RFC 3986 resolver, but the WebOb stubs do not expose it. This adds overloads that preserve the return type for regular string inputs and WebOb’s supportedNoneshort-circuits, plus regression cases for each return shape.Upstream implementation: Pylons/webob@a6c142294813
Upstream
Nonehandling: Pylons/webob@d3077b8444f9Validation:
python tests/runtests.py stubs/WebOb --run-stubtestmypy.stubtest(19 modules)