← baseline_full_v2

fastapi_14962

failed NO_PATCH NO_PATCH UNSUBMITTED empty_patch(None) · None tool calls · 0 s · fastapi/fastapi

Task input

✨ Serialize JSON response with Pydantic (in Rust), when there's a Pydantic return type or response model

✨ Serialize JSON response with Pydantic (in Rust), when there's a Pydantic return type or response model

Tool calls (0)

#ToolArgumentsResult
No trace captured.

Test output

show
F
=================================== FAILURES ===================================
_________________ test_default_response_class_skips_json_dumps _________________

    def test_default_response_class_skips_json_dumps():
        """When no response_class is set, the fast path serializes directly to
        JSON bytes via Pydantic's dump_json and never calls json.dumps."""
        with patch(
            "starlette.responses.json.dumps", wraps=__import__("json").dumps
        ) as mock_dumps:
            response = client.get("/default")
        assert response.status_code == 200
        assert response.json() == {"name": "widget", "price": 9.99}
>       mock_dumps.assert_not_called()

tests/test_dump_json_fast_path.py:39: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <MagicMock name='dumps' id='4426269424'>

    def assert_not_called(self):
        """assert that the mock was never called.
        """
        if self.call_count != 0:
            msg = ("Expected '%s' to not have been called. Called %s times.%s"
                   % (self._mock_name or 'mock',
                      self.call_count,
                      self._calls_repr()))
>           raise AssertionError(msg)
E           AssertionError: Expected 'dumps' to not have been called. Called 1 times.
E           Calls: [call({'name': 'widget', 'price': 9.99}, ensure_ascii=False, allow_nan=False, indent=None, separators=(',', ':'))].

/Users/jp/.local/share/uv/python/cpython-3.13.15-macos-aarch64-none/lib/python3.13/unittest/mock.py:940: AssertionError
=============================== warnings summary ===============================
../../../../../../../Users/jp/repos/kaggle-gemini-coding-agent-post-training/.envs/overlays/starlette-0.52.1-py3-none-any/starlette/testclient.py:45
  /Users/jp/repos/kaggle-gemini-coding-agent-post-training/.envs/overlays/starlette-0.52.1-py3-none-any/starlette/testclient.py:45: DeprecationWarning: The anyio.abc.BlockingPortal alias is deprecated, use anyio.from_thread.BlockingPortal instead.
    _PortalFactoryType = Callable[[], AbstractContextManager[anyio.abc.BlockingPortal]]

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
!!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!
1 failed, 1 warning in 0.67s