Skip to content

Commit 7de371c

Browse files
chore(internal): variable name and test updates (#79)
1 parent 140ac8b commit 7de371c

File tree

1 file changed

+16
-18
lines changed

1 file changed

+16
-18
lines changed

Diff for: tests/api_resources/test_events.py

+16-18
Original file line numberDiff line numberDiff line change
@@ -69,27 +69,26 @@ def test_streaming_response_list(self, client: Gitpod) -> None:
6969
@pytest.mark.skip(reason="Prism doesn't support JSONL responses yet")
7070
@parametrize
7171
def test_method_watch(self, client: Gitpod) -> None:
72-
event = client.events.watch()
73-
assert_matches_type(JSONLDecoder[EventWatchResponse], event, path=["response"])
72+
event_stream = client.events.watch()
73+
assert_matches_type(JSONLDecoder[EventWatchResponse], event_stream, path=["response"])
7474

7575
@pytest.mark.skip(reason="Prism doesn't support JSONL responses yet")
7676
@parametrize
7777
def test_method_watch_with_all_params(self, client: Gitpod) -> None:
78-
event = client.events.watch(
78+
event_stream = client.events.watch(
7979
environment_id="environmentId",
8080
organization=True,
8181
)
82-
assert_matches_type(JSONLDecoder[EventWatchResponse], event, path=["response"])
82+
assert_matches_type(JSONLDecoder[EventWatchResponse], event_stream, path=["response"])
8383

8484
@pytest.mark.skip(reason="Prism doesn't support JSONL responses yet")
8585
@parametrize
8686
def test_raw_response_watch(self, client: Gitpod) -> None:
8787
response = client.events.with_raw_response.watch()
8888

89-
assert response.is_closed is True
9089
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
91-
event = response.parse()
92-
assert_matches_type(JSONLDecoder[EventWatchResponse], event, path=["response"])
90+
stream = response.parse()
91+
stream.close()
9392

9493
@pytest.mark.skip(reason="Prism doesn't support JSONL responses yet")
9594
@parametrize
@@ -98,8 +97,8 @@ def test_streaming_response_watch(self, client: Gitpod) -> None:
9897
assert not response.is_closed
9998
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
10099

101-
event = response.parse()
102-
assert_matches_type(JSONLDecoder[EventWatchResponse], event, path=["response"])
100+
stream = response.parse()
101+
stream.close()
103102

104103
assert cast(Any, response.is_closed) is True
105104

@@ -157,27 +156,26 @@ async def test_streaming_response_list(self, async_client: AsyncGitpod) -> None:
157156
@pytest.mark.skip(reason="Prism doesn't support JSONL responses yet")
158157
@parametrize
159158
async def test_method_watch(self, async_client: AsyncGitpod) -> None:
160-
event = await async_client.events.watch()
161-
assert_matches_type(AsyncJSONLDecoder[EventWatchResponse], event, path=["response"])
159+
event_stream = await async_client.events.watch()
160+
assert_matches_type(AsyncJSONLDecoder[EventWatchResponse], event_stream, path=["response"])
162161

163162
@pytest.mark.skip(reason="Prism doesn't support JSONL responses yet")
164163
@parametrize
165164
async def test_method_watch_with_all_params(self, async_client: AsyncGitpod) -> None:
166-
event = await async_client.events.watch(
165+
event_stream = await async_client.events.watch(
167166
environment_id="environmentId",
168167
organization=True,
169168
)
170-
assert_matches_type(AsyncJSONLDecoder[EventWatchResponse], event, path=["response"])
169+
assert_matches_type(AsyncJSONLDecoder[EventWatchResponse], event_stream, path=["response"])
171170

172171
@pytest.mark.skip(reason="Prism doesn't support JSONL responses yet")
173172
@parametrize
174173
async def test_raw_response_watch(self, async_client: AsyncGitpod) -> None:
175174
response = await async_client.events.with_raw_response.watch()
176175

177-
assert response.is_closed is True
178176
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
179-
event = await response.parse()
180-
assert_matches_type(AsyncJSONLDecoder[EventWatchResponse], event, path=["response"])
177+
stream = await response.parse()
178+
await stream.close()
181179

182180
@pytest.mark.skip(reason="Prism doesn't support JSONL responses yet")
183181
@parametrize
@@ -186,7 +184,7 @@ async def test_streaming_response_watch(self, async_client: AsyncGitpod) -> None
186184
assert not response.is_closed
187185
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
188186

189-
event = await response.parse()
190-
assert_matches_type(AsyncJSONLDecoder[EventWatchResponse], event, path=["response"])
187+
stream = await response.parse()
188+
await stream.close()
191189

192190
assert cast(Any, response.is_closed) is True

0 commit comments

Comments
 (0)