Debian Codegraph @

tests/api_resources/beta/test_environments.py

raw
1 from __future__ import annotations
2
3 import os
4 from typing import Any, cast
5
6 import pytest
7
8 from anthropic import Anthropic, AsyncAnthropic
9 from tests.utils import assert_matches_type
10 from anthropic.pagination import SyncPageCursor, AsyncPageCursor
11 from anthropic.types.beta import (
12 BetaEnvironment,
13 BetaEnvironmentDeleteResponse,
14 )
15
16 base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
17
18
19 class TestEnvironments:
20 parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
21
22 @parametrize
23 def test_method_create(self, client: Anthropic) -> None:
24 environment = client.beta.environments.create(
25 name="python-data-analysis",
26 )
27 assert_matches_type(BetaEnvironment, environment, path=["response"])
28
29 @parametrize
30 def test_method_create_with_all_params(self, client: Anthropic) -> None:
31 environment = client.beta.environments.create(
32 name="python-data-analysis",
33 config={
34 "type": "cloud",
35 "networking": {
36 "type": "limited",
37 "allow_mcp_servers": True,
38 "allow_package_managers": True,
39 "allowed_hosts": ["api.example.com"],
40 },
41 "packages": {
42 "apt": ["string"],
43 "cargo": ["string"],
44 "gem": ["string"],
45 "go": ["string"],
46 "npm": ["string"],
47 "pip": ["pandas", "numpy"],
48 "type": "packages",
49 },
50 },
51 description="Python environment with data-analysis packages.",
52 metadata={"foo": "string"},
53 scope="organization",
54 betas=["message-batches-2024-09-24"],
55 workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy",
56 )
57 assert_matches_type(BetaEnvironment, environment, path=["response"])
58
59 @parametrize
60 def test_raw_response_create(self, client: Anthropic) -> None:
61 response = client.beta.environments.with_raw_response.create(
62 name="python-data-analysis",
63 )
64
65 assert response.is_closed is True
66 assert response.http_request.headers.get("X-Stainless-Lang") == "python"
67 environment = response.parse()
68 assert_matches_type(BetaEnvironment, environment, path=["response"])
69
70 @parametrize
71 def test_streaming_response_create(self, client: Anthropic) -> None:
72 with client.beta.environments.with_streaming_response.create(
73 name="python-data-analysis",
74 ) as response:
75 assert not response.is_closed
76 assert response.http_request.headers.get("X-Stainless-Lang") == "python"
77
78 environment = response.parse()
79 assert_matches_type(BetaEnvironment, environment, path=["response"])
80
81 assert cast(Any, response.is_closed) is True
82
83 @parametrize
84 def test_method_retrieve(self, client: Anthropic) -> None:
85 environment = client.beta.environments.retrieve(
86 environment_id="env_011CZkZ9X2dpNyB7HsEFoRfW",
87 )
88 assert_matches_type(BetaEnvironment, environment, path=["response"])
89
90 @parametrize
91 def test_method_retrieve_with_all_params(self, client: Anthropic) -> None:
92 environment = client.beta.environments.retrieve(
93 environment_id="env_011CZkZ9X2dpNyB7HsEFoRfW",
94 betas=["message-batches-2024-09-24"],
95 workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy",
96 )
97 assert_matches_type(BetaEnvironment, environment, path=["response"])
98
99 @parametrize
100 def test_raw_response_retrieve(self, client: Anthropic) -> None:
101 response = client.beta.environments.with_raw_response.retrieve(
102 environment_id="env_011CZkZ9X2dpNyB7HsEFoRfW",
103 )
104
105 assert response.is_closed is True
106 assert response.http_request.headers.get("X-Stainless-Lang") == "python"
107 environment = response.parse()
108 assert_matches_type(BetaEnvironment, environment, path=["response"])
109
110 @parametrize
111 def test_streaming_response_retrieve(self, client: Anthropic) -> None:
112 with client.beta.environments.with_streaming_response.retrieve(
113 environment_id="env_011CZkZ9X2dpNyB7HsEFoRfW",
114 ) as response:
115 assert not response.is_closed
116 assert response.http_request.headers.get("X-Stainless-Lang") == "python"
117
118 environment = response.parse()
119 assert_matches_type(BetaEnvironment, environment, path=["response"])
120
121 assert cast(Any, response.is_closed) is True
122
123 @parametrize
124 def test_path_params_retrieve(self, client: Anthropic) -> None:
125 with pytest.raises(ValueError, match=r"Expected a non-empty value for `environment_id` but received ''"):
126 client.beta.environments.with_raw_response.retrieve(
127 environment_id="",
128 )
129
130 @parametrize
131 def test_method_update(self, client: Anthropic) -> None:
132 environment = client.beta.environments.update(
133 environment_id="env_011CZkZ9X2dpNyB7HsEFoRfW",
134 )
135 assert_matches_type(BetaEnvironment, environment, path=["response"])
136
137 @parametrize
138 def test_method_update_with_all_params(self, client: Anthropic) -> None:
139 environment = client.beta.environments.update(
140 environment_id="env_011CZkZ9X2dpNyB7HsEFoRfW",
141 config={
142 "type": "cloud",
143 "networking": {
144 "type": "limited",
145 "allow_mcp_servers": True,
146 "allow_package_managers": True,
147 "allowed_hosts": ["api.example.com"],
148 },
149 "packages": {
150 "apt": ["string"],
151 "cargo": ["string"],
152 "gem": ["string"],
153 "go": ["string"],
154 "npm": ["string"],
155 "pip": ["pandas", "numpy"],
156 "type": "packages",
157 },
158 },
159 description="Python environment with data-analysis packages.",
160 metadata={"foo": "string"},
161 name="x",
162 scope="organization",
163 betas=["message-batches-2024-09-24"],
164 workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy",
165 )
166 assert_matches_type(BetaEnvironment, environment, path=["response"])
167
168 @parametrize
169 def test_raw_response_update(self, client: Anthropic) -> None:
170 response = client.beta.environments.with_raw_response.update(
171 environment_id="env_011CZkZ9X2dpNyB7HsEFoRfW",
172 )
173
174 assert response.is_closed is True
175 assert response.http_request.headers.get("X-Stainless-Lang") == "python"
176 environment = response.parse()
177 assert_matches_type(BetaEnvironment, environment, path=["response"])
178
179 @parametrize
180 def test_streaming_response_update(self, client: Anthropic) -> None:
181 with client.beta.environments.with_streaming_response.update(
182 environment_id="env_011CZkZ9X2dpNyB7HsEFoRfW",
183 ) as response:
184 assert not response.is_closed
185 assert response.http_request.headers.get("X-Stainless-Lang") == "python"
186
187 environment = response.parse()
188 assert_matches_type(BetaEnvironment, environment, path=["response"])
189
190 assert cast(Any, response.is_closed) is True
191
192 @parametrize
193 def test_path_params_update(self, client: Anthropic) -> None:
194 with pytest.raises(ValueError, match=r"Expected a non-empty value for `environment_id` but received ''"):
195 client.beta.environments.with_raw_response.update(
196 environment_id="",
197 )
198
199 @parametrize
200 def test_method_list(self, client: Anthropic) -> None:
201 environment = client.beta.environments.list()
202 assert_matches_type(SyncPageCursor[BetaEnvironment], environment, path=["response"])
203
204 @parametrize
205 def test_method_list_with_all_params(self, client: Anthropic) -> None:
206 environment = client.beta.environments.list(
207 include_archived=True,
208 limit=1,
209 page="page",
210 betas=["message-batches-2024-09-24"],
211 workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy",
212 )
213 assert_matches_type(SyncPageCursor[BetaEnvironment], environment, path=["response"])
214
215 @parametrize
216 def test_raw_response_list(self, client: Anthropic) -> None:
217 response = client.beta.environments.with_raw_response.list()
218
219 assert response.is_closed is True
220 assert response.http_request.headers.get("X-Stainless-Lang") == "python"
221 environment = response.parse()
222 assert_matches_type(SyncPageCursor[BetaEnvironment], environment, path=["response"])
223
224 @parametrize
225 def test_streaming_response_list(self, client: Anthropic) -> None:
226 with client.beta.environments.with_streaming_response.list() as response:
227 assert not response.is_closed
228 assert response.http_request.headers.get("X-Stainless-Lang") == "python"
229
230 environment = response.parse()
231 assert_matches_type(SyncPageCursor[BetaEnvironment], environment, path=["response"])
232
233 assert cast(Any, response.is_closed) is True
234
235 @parametrize
236 def test_method_delete(self, client: Anthropic) -> None:
237 environment = client.beta.environments.delete(
238 environment_id="env_011CZkZ9X2dpNyB7HsEFoRfW",
239 )
240 assert_matches_type(BetaEnvironmentDeleteResponse, environment, path=["response"])
241
242 @parametrize
243 def test_method_delete_with_all_params(self, client: Anthropic) -> None:
244 environment = client.beta.environments.delete(
245 environment_id="env_011CZkZ9X2dpNyB7HsEFoRfW",
246 betas=["message-batches-2024-09-24"],
247 workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy",
248 )
249 assert_matches_type(BetaEnvironmentDeleteResponse, environment, path=["response"])
250
251 @parametrize
252 def test_raw_response_delete(self, client: Anthropic) -> None:
253 response = client.beta.environments.with_raw_response.delete(
254 environment_id="env_011CZkZ9X2dpNyB7HsEFoRfW",
255 )
256
257 assert response.is_closed is True
258 assert response.http_request.headers.get("X-Stainless-Lang") == "python"
259 environment = response.parse()
260 assert_matches_type(BetaEnvironmentDeleteResponse, environment, path=["response"])
261
262 @parametrize
263 def test_streaming_response_delete(self, client: Anthropic) -> None:
264 with client.beta.environments.with_streaming_response.delete(
265 environment_id="env_011CZkZ9X2dpNyB7HsEFoRfW",
266 ) as response:
267 assert not response.is_closed
268 assert response.http_request.headers.get("X-Stainless-Lang") == "python"
269
270 environment = response.parse()
271 assert_matches_type(BetaEnvironmentDeleteResponse, environment, path=["response"])
272
273 assert cast(Any, response.is_closed) is True
274
275 @parametrize
276 def test_path_params_delete(self, client: Anthropic) -> None:
277 with pytest.raises(ValueError, match=r"Expected a non-empty value for `environment_id` but received ''"):
278 client.beta.environments.with_raw_response.delete(
279 environment_id="",
280 )
281
282 @parametrize
283 def test_method_archive(self, client: Anthropic) -> None:
284 environment = client.beta.environments.archive(
285 environment_id="env_011CZkZ9X2dpNyB7HsEFoRfW",
286 )
287 assert_matches_type(BetaEnvironment, environment, path=["response"])
288
289 @parametrize
290 def test_method_archive_with_all_params(self, client: Anthropic) -> None:
291 environment = client.beta.environments.archive(
292 environment_id="env_011CZkZ9X2dpNyB7HsEFoRfW",
293 betas=["message-batches-2024-09-24"],
294 workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy",
295 )
296 assert_matches_type(BetaEnvironment, environment, path=["response"])
297
298 @parametrize
299 def test_raw_response_archive(self, client: Anthropic) -> None:
300 response = client.beta.environments.with_raw_response.archive(
301 environment_id="env_011CZkZ9X2dpNyB7HsEFoRfW",
302 )
303
304 assert response.is_closed is True
305 assert response.http_request.headers.get("X-Stainless-Lang") == "python"
306 environment = response.parse()
307 assert_matches_type(BetaEnvironment, environment, path=["response"])
308
309 @parametrize
310 def test_streaming_response_archive(self, client: Anthropic) -> None:
311 with client.beta.environments.with_streaming_response.archive(
312 environment_id="env_011CZkZ9X2dpNyB7HsEFoRfW",
313 ) as response:
314 assert not response.is_closed
315 assert response.http_request.headers.get("X-Stainless-Lang") == "python"
316
317 environment = response.parse()
318 assert_matches_type(BetaEnvironment, environment, path=["response"])
319
320 assert cast(Any, response.is_closed) is True
321
322 @parametrize
323 def test_path_params_archive(self, client: Anthropic) -> None:
324 with pytest.raises(ValueError, match=r"Expected a non-empty value for `environment_id` but received ''"):
325 client.beta.environments.with_raw_response.archive(
326 environment_id="",
327 )
328
329
330 class TestAsyncEnvironments:
331 parametrize = pytest.mark.parametrize(
332 "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"]
333 )
334
335 @parametrize
336 async def test_method_create(self, async_client: AsyncAnthropic) -> None:
337 environment = await async_client.beta.environments.create(
338 name="python-data-analysis",
339 )
340 assert_matches_type(BetaEnvironment, environment, path=["response"])
341
342 @parametrize
343 async def test_method_create_with_all_params(self, async_client: AsyncAnthropic) -> None:
344 environment = await async_client.beta.environments.create(
345 name="python-data-analysis",
346 config={
347 "type": "cloud",
348 "networking": {
349 "type": "limited",
350 "allow_mcp_servers": True,
351 "allow_package_managers": True,
352 "allowed_hosts": ["api.example.com"],
353 },
354 "packages": {
355 "apt": ["string"],
356 "cargo": ["string"],
357 "gem": ["string"],
358 "go": ["string"],
359 "npm": ["string"],
360 "pip": ["pandas", "numpy"],
361 "type": "packages",
362 },
363 },
364 description="Python environment with data-analysis packages.",
365 metadata={"foo": "string"},
366 scope="organization",
367 betas=["message-batches-2024-09-24"],
368 workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy",
369 )
370 assert_matches_type(BetaEnvironment, environment, path=["response"])
371
372 @parametrize
373 async def test_raw_response_create(self, async_client: AsyncAnthropic) -> None:
374 response = await async_client.beta.environments.with_raw_response.create(
375 name="python-data-analysis",
376 )
377
378 assert response.is_closed is True
379 assert response.http_request.headers.get("X-Stainless-Lang") == "python"
380 environment = await response.parse()
381 assert_matches_type(BetaEnvironment, environment, path=["response"])
382
383 @parametrize
384 async def test_streaming_response_create(self, async_client: AsyncAnthropic) -> None:
385 async with async_client.beta.environments.with_streaming_response.create(
386 name="python-data-analysis",
387 ) as response:
388 assert not response.is_closed
389 assert response.http_request.headers.get("X-Stainless-Lang") == "python"
390
391 environment = await response.parse()
392 assert_matches_type(BetaEnvironment, environment, path=["response"])
393
394 assert cast(Any, response.is_closed) is True
395
396 @parametrize
397 async def test_method_retrieve(self, async_client: AsyncAnthropic) -> None:
398 environment = await async_client.beta.environments.retrieve(
399 environment_id="env_011CZkZ9X2dpNyB7HsEFoRfW",
400 )
401 assert_matches_type(BetaEnvironment, environment, path=["response"])
402
403 @parametrize
404 async def test_method_retrieve_with_all_params(self, async_client: AsyncAnthropic) -> None:
405 environment = await async_client.beta.environments.retrieve(
406 environment_id="env_011CZkZ9X2dpNyB7HsEFoRfW",
407 betas=["message-batches-2024-09-24"],
408 workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy",
409 )
410 assert_matches_type(BetaEnvironment, environment, path=["response"])
411
412 @parametrize
413 async def test_raw_response_retrieve(self, async_client: AsyncAnthropic) -> None:
414 response = await async_client.beta.environments.with_raw_response.retrieve(
415 environment_id="env_011CZkZ9X2dpNyB7HsEFoRfW",
416 )
417
418 assert response.is_closed is True
419 assert response.http_request.headers.get("X-Stainless-Lang") == "python"
420 environment = await response.parse()
421 assert_matches_type(BetaEnvironment, environment, path=["response"])
422
423 @parametrize
424 async def test_streaming_response_retrieve(self, async_client: AsyncAnthropic) -> None:
425 async with async_client.beta.environments.with_streaming_response.retrieve(
426 environment_id="env_011CZkZ9X2dpNyB7HsEFoRfW",
427 ) as response:
428 assert not response.is_closed
429 assert response.http_request.headers.get("X-Stainless-Lang") == "python"
430
431 environment = await response.parse()
432 assert_matches_type(BetaEnvironment, environment, path=["response"])
433
434 assert cast(Any, response.is_closed) is True
435
436 @parametrize
437 async def test_path_params_retrieve(self, async_client: AsyncAnthropic) -> None:
438 with pytest.raises(ValueError, match=r"Expected a non-empty value for `environment_id` but received ''"):
439 await async_client.beta.environments.with_raw_response.retrieve(
440 environment_id="",
441 )
442
443 @parametrize
444 async def test_method_update(self, async_client: AsyncAnthropic) -> None:
445 environment = await async_client.beta.environments.update(
446 environment_id="env_011CZkZ9X2dpNyB7HsEFoRfW",
447 )
448 assert_matches_type(BetaEnvironment, environment, path=["response"])
449
450 @parametrize
451 async def test_method_update_with_all_params(self, async_client: AsyncAnthropic) -> None:
452 environment = await async_client.beta.environments.update(
453 environment_id="env_011CZkZ9X2dpNyB7HsEFoRfW",
454 config={
455 "type": "cloud",
456 "networking": {
457 "type": "limited",
458 "allow_mcp_servers": True,
459 "allow_package_managers": True,
460 "allowed_hosts": ["api.example.com"],
461 },
462 "packages": {
463 "apt": ["string"],
464 "cargo": ["string"],
465 "gem": ["string"],
466 "go": ["string"],
467 "npm": ["string"],
468 "pip": ["pandas", "numpy"],
469 "type": "packages",
470 },
471 },
472 description="Python environment with data-analysis packages.",
473 metadata={"foo": "string"},
474 name="x",
475 scope="organization",
476 betas=["message-batches-2024-09-24"],
477 workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy",
478 )
479 assert_matches_type(BetaEnvironment, environment, path=["response"])
480
481 @parametrize
482 async def test_raw_response_update(self, async_client: AsyncAnthropic) -> None:
483 response = await async_client.beta.environments.with_raw_response.update(
484 environment_id="env_011CZkZ9X2dpNyB7HsEFoRfW",
485 )
486
487 assert response.is_closed is True
488 assert response.http_request.headers.get("X-Stainless-Lang") == "python"
489 environment = await response.parse()
490 assert_matches_type(BetaEnvironment, environment, path=["response"])
491
492 @parametrize
493 async def test_streaming_response_update(self, async_client: AsyncAnthropic) -> None:
494 async with async_client.beta.environments.with_streaming_response.update(
495 environment_id="env_011CZkZ9X2dpNyB7HsEFoRfW",
496 ) as response:
497 assert not response.is_closed
498 assert response.http_request.headers.get("X-Stainless-Lang") == "python"
499
500 environment = await response.parse()
501 assert_matches_type(BetaEnvironment, environment, path=["response"])
502
503 assert cast(Any, response.is_closed) is True
504
505 @parametrize
506 async def test_path_params_update(self, async_client: AsyncAnthropic) -> None:
507 with pytest.raises(ValueError, match=r"Expected a non-empty value for `environment_id` but received ''"):
508 await async_client.beta.environments.with_raw_response.update(
509 environment_id="",
510 )
511
512 @parametrize
513 async def test_method_list(self, async_client: AsyncAnthropic) -> None:
514 environment = await async_client.beta.environments.list()
515 assert_matches_type(AsyncPageCursor[BetaEnvironment], environment, path=["response"])
516
517 @parametrize
518 async def test_method_list_with_all_params(self, async_client: AsyncAnthropic) -> None:
519 environment = await async_client.beta.environments.list(
520 include_archived=True,
521 limit=1,
522 page="page",
523 betas=["message-batches-2024-09-24"],
524 workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy",
525 )
526 assert_matches_type(AsyncPageCursor[BetaEnvironment], environment, path=["response"])
527
528 @parametrize
529 async def test_raw_response_list(self, async_client: AsyncAnthropic) -> None:
530 response = await async_client.beta.environments.with_raw_response.list()
531
532 assert response.is_closed is True
533 assert response.http_request.headers.get("X-Stainless-Lang") == "python"
534 environment = await response.parse()
535 assert_matches_type(AsyncPageCursor[BetaEnvironment], environment, path=["response"])
536
537 @parametrize
538 async def test_streaming_response_list(self, async_client: AsyncAnthropic) -> None:
539 async with async_client.beta.environments.with_streaming_response.list() as response:
540 assert not response.is_closed
541 assert response.http_request.headers.get("X-Stainless-Lang") == "python"
542
543 environment = await response.parse()
544 assert_matches_type(AsyncPageCursor[BetaEnvironment], environment, path=["response"])
545
546 assert cast(Any, response.is_closed) is True
547
548 @parametrize
549 async def test_method_delete(self, async_client: AsyncAnthropic) -> None:
550 environment = await async_client.beta.environments.delete(
551 environment_id="env_011CZkZ9X2dpNyB7HsEFoRfW",
552 )
553 assert_matches_type(BetaEnvironmentDeleteResponse, environment, path=["response"])
554
555 @parametrize
556 async def test_method_delete_with_all_params(self, async_client: AsyncAnthropic) -> None:
557 environment = await async_client.beta.environments.delete(
558 environment_id="env_011CZkZ9X2dpNyB7HsEFoRfW",
559 betas=["message-batches-2024-09-24"],
560 workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy",
561 )
562 assert_matches_type(BetaEnvironmentDeleteResponse, environment, path=["response"])
563
564 @parametrize
565 async def test_raw_response_delete(self, async_client: AsyncAnthropic) -> None:
566 response = await async_client.beta.environments.with_raw_response.delete(
567 environment_id="env_011CZkZ9X2dpNyB7HsEFoRfW",
568 )
569
570 assert response.is_closed is True
571 assert response.http_request.headers.get("X-Stainless-Lang") == "python"
572 environment = await response.parse()
573 assert_matches_type(BetaEnvironmentDeleteResponse, environment, path=["response"])
574
575 @parametrize
576 async def test_streaming_response_delete(self, async_client: AsyncAnthropic) -> None:
577 async with async_client.beta.environments.with_streaming_response.delete(
578 environment_id="env_011CZkZ9X2dpNyB7HsEFoRfW",
579 ) as response:
580 assert not response.is_closed
581 assert response.http_request.headers.get("X-Stainless-Lang") == "python"
582
583 environment = await response.parse()
584 assert_matches_type(BetaEnvironmentDeleteResponse, environment, path=["response"])
585
586 assert cast(Any, response.is_closed) is True
587
588 @parametrize
589 async def test_path_params_delete(self, async_client: AsyncAnthropic) -> None:
590 with pytest.raises(ValueError, match=r"Expected a non-empty value for `environment_id` but received ''"):
591 await async_client.beta.environments.with_raw_response.delete(
592 environment_id="",
593 )
594
595 @parametrize
596 async def test_method_archive(self, async_client: AsyncAnthropic) -> None:
597 environment = await async_client.beta.environments.archive(
598 environment_id="env_011CZkZ9X2dpNyB7HsEFoRfW",
599 )
600 assert_matches_type(BetaEnvironment, environment, path=["response"])
601
602 @parametrize
603 async def test_method_archive_with_all_params(self, async_client: AsyncAnthropic) -> None:
604 environment = await async_client.beta.environments.archive(
605 environment_id="env_011CZkZ9X2dpNyB7HsEFoRfW",
606 betas=["message-batches-2024-09-24"],
607 workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy",
608 )
609 assert_matches_type(BetaEnvironment, environment, path=["response"])
610
611 @parametrize
612 async def test_raw_response_archive(self, async_client: AsyncAnthropic) -> None:
613 response = await async_client.beta.environments.with_raw_response.archive(
614 environment_id="env_011CZkZ9X2dpNyB7HsEFoRfW",
615 )
616
617 assert response.is_closed is True
618 assert response.http_request.headers.get("X-Stainless-Lang") == "python"
619 environment = await response.parse()
620 assert_matches_type(BetaEnvironment, environment, path=["response"])
621
622 @parametrize
623 async def test_streaming_response_archive(self, async_client: AsyncAnthropic) -> None:
624 async with async_client.beta.environments.with_streaming_response.archive(
625 environment_id="env_011CZkZ9X2dpNyB7HsEFoRfW",
626 ) as response:
627 assert not response.is_closed
628 assert response.http_request.headers.get("X-Stainless-Lang") == "python"
629
630 environment = await response.parse()
631 assert_matches_type(BetaEnvironment, environment, path=["response"])
632
633 assert cast(Any, response.is_closed) is True
634
635 @parametrize
636 async def test_path_params_archive(self, async_client: AsyncAnthropic) -> None:
637 with pytest.raises(ValueError, match=r"Expected a non-empty value for `environment_id` but received ''"):
638 await async_client.beta.environments.with_raw_response.archive(
639 environment_id="",
640 )