From 5e45a68ac86520bd7144e070b49bfbbf918a419f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 4 Apr 2025 08:18:04 +0000 Subject: [PATCH] chore(internal): variable name and test updates --- tests/api_resources/test_events.py | 34 ++++++++++++++---------------- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/tests/api_resources/test_events.py b/tests/api_resources/test_events.py index 977730ed..77b33af8 100644 --- a/tests/api_resources/test_events.py +++ b/tests/api_resources/test_events.py @@ -69,27 +69,26 @@ def test_streaming_response_list(self, client: Gitpod) -> None: @pytest.mark.skip(reason="Prism doesn't support JSONL responses yet") @parametrize def test_method_watch(self, client: Gitpod) -> None: - event = client.events.watch() - assert_matches_type(JSONLDecoder[EventWatchResponse], event, path=["response"]) + event_stream = client.events.watch() + assert_matches_type(JSONLDecoder[EventWatchResponse], event_stream, path=["response"]) @pytest.mark.skip(reason="Prism doesn't support JSONL responses yet") @parametrize def test_method_watch_with_all_params(self, client: Gitpod) -> None: - event = client.events.watch( + event_stream = client.events.watch( environment_id="environmentId", organization=True, ) - assert_matches_type(JSONLDecoder[EventWatchResponse], event, path=["response"]) + assert_matches_type(JSONLDecoder[EventWatchResponse], event_stream, path=["response"]) @pytest.mark.skip(reason="Prism doesn't support JSONL responses yet") @parametrize def test_raw_response_watch(self, client: Gitpod) -> None: response = client.events.with_raw_response.watch() - assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - event = response.parse() - assert_matches_type(JSONLDecoder[EventWatchResponse], event, path=["response"]) + stream = response.parse() + stream.close() @pytest.mark.skip(reason="Prism doesn't support JSONL responses yet") @parametrize @@ -98,8 +97,8 @@ def test_streaming_response_watch(self, client: Gitpod) -> None: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - event = response.parse() - assert_matches_type(JSONLDecoder[EventWatchResponse], event, path=["response"]) + stream = response.parse() + stream.close() assert cast(Any, response.is_closed) is True @@ -157,27 +156,26 @@ async def test_streaming_response_list(self, async_client: AsyncGitpod) -> None: @pytest.mark.skip(reason="Prism doesn't support JSONL responses yet") @parametrize async def test_method_watch(self, async_client: AsyncGitpod) -> None: - event = await async_client.events.watch() - assert_matches_type(AsyncJSONLDecoder[EventWatchResponse], event, path=["response"]) + event_stream = await async_client.events.watch() + assert_matches_type(AsyncJSONLDecoder[EventWatchResponse], event_stream, path=["response"]) @pytest.mark.skip(reason="Prism doesn't support JSONL responses yet") @parametrize async def test_method_watch_with_all_params(self, async_client: AsyncGitpod) -> None: - event = await async_client.events.watch( + event_stream = await async_client.events.watch( environment_id="environmentId", organization=True, ) - assert_matches_type(AsyncJSONLDecoder[EventWatchResponse], event, path=["response"]) + assert_matches_type(AsyncJSONLDecoder[EventWatchResponse], event_stream, path=["response"]) @pytest.mark.skip(reason="Prism doesn't support JSONL responses yet") @parametrize async def test_raw_response_watch(self, async_client: AsyncGitpod) -> None: response = await async_client.events.with_raw_response.watch() - assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - event = await response.parse() - assert_matches_type(AsyncJSONLDecoder[EventWatchResponse], event, path=["response"]) + stream = await response.parse() + await stream.close() @pytest.mark.skip(reason="Prism doesn't support JSONL responses yet") @parametrize @@ -186,7 +184,7 @@ async def test_streaming_response_watch(self, async_client: AsyncGitpod) -> None assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - event = await response.parse() - assert_matches_type(AsyncJSONLDecoder[EventWatchResponse], event, path=["response"]) + stream = await response.parse() + await stream.close() assert cast(Any, response.is_closed) is True