Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test.Client is incorrectly using isinstance check instead of issubclass #2831

Closed
jace opened this issue Jan 8, 2024 · 0 comments · Fixed by #2832
Closed

test.Client is incorrectly using isinstance check instead of issubclass #2831

jace opened this issue Jan 8, 2024 · 0 comments · Fixed by #2832

Comments

@jace
Copy link
Contributor

jace commented Jan 8, 2024

The documentation for werkzeug.test.Client says it expects a subclass of TestResponse, failing which it will construct the subclass:

:param response_wrapper: A :class:`.Response` class to wrap response data with.
Defaults to :class:`.TestResponse`. If it's not a subclass of ``TestResponse``,
one will be created.

However, the implementation is using isinstance instead of issubclass:

elif not isinstance(response_wrapper, TestResponse):
response_wrapper = type(
"WrapperTestResponse",
(TestResponse, response_wrapper), # type: ignore
{},
)

The problem was introduced in commit 669323c (specific lines) so it's been around since the 2.0 release.

pgjones pushed a commit that referenced this issue Mar 3, 2024
@pgjones pgjones closed this as completed Mar 3, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants