openai/openai-python
Publicmirrored fromhttps://github.com/openai/openai-pythonAvailable
tests/api_resources/beta/test_threads.py
1238lines · modecode
| 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. |
| 2 | |
| 3 | from __future__ import annotations |
| 4 | |
| 5 | import os |
| 6 | from typing import Any, cast |
| 7 | |
| 8 | import pytest |
| 9 | |
| 10 | from openai import OpenAI, AsyncOpenAI |
| 11 | from tests.utils import assert_matches_type |
| 12 | from openai.types.beta import ( |
| 13 | Thread, |
| 14 | ThreadDeleted, |
| 15 | ) |
| 16 | from openai.types.beta.threads import Run |
| 17 | |
| 18 | base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") |
| 19 | |
| 20 | |
| 21 | class TestThreads: |
| 22 | parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) |
| 23 | |
| 24 | @parametrize |
| 25 | def test_method_create(self, client: OpenAI) -> None: |
| 26 | thread = client.beta.threads.create() |
| 27 | assert_matches_type(Thread, thread, path=["response"]) |
| 28 | |
| 29 | @parametrize |
| 30 | def test_method_create_with_all_params(self, client: OpenAI) -> None: |
| 31 | thread = client.beta.threads.create( |
| 32 | messages=[ |
| 33 | { |
| 34 | "content": "string", |
| 35 | "role": "user", |
| 36 | "attachments": [ |
| 37 | { |
| 38 | "file_id": "string", |
| 39 | "tools": [ |
| 40 | {"type": "code_interpreter"}, |
| 41 | {"type": "code_interpreter"}, |
| 42 | {"type": "code_interpreter"}, |
| 43 | ], |
| 44 | }, |
| 45 | { |
| 46 | "file_id": "string", |
| 47 | "tools": [ |
| 48 | {"type": "code_interpreter"}, |
| 49 | {"type": "code_interpreter"}, |
| 50 | {"type": "code_interpreter"}, |
| 51 | ], |
| 52 | }, |
| 53 | { |
| 54 | "file_id": "string", |
| 55 | "tools": [ |
| 56 | {"type": "code_interpreter"}, |
| 57 | {"type": "code_interpreter"}, |
| 58 | {"type": "code_interpreter"}, |
| 59 | ], |
| 60 | }, |
| 61 | ], |
| 62 | "metadata": {}, |
| 63 | }, |
| 64 | { |
| 65 | "content": "string", |
| 66 | "role": "user", |
| 67 | "attachments": [ |
| 68 | { |
| 69 | "file_id": "string", |
| 70 | "tools": [ |
| 71 | {"type": "code_interpreter"}, |
| 72 | {"type": "code_interpreter"}, |
| 73 | {"type": "code_interpreter"}, |
| 74 | ], |
| 75 | }, |
| 76 | { |
| 77 | "file_id": "string", |
| 78 | "tools": [ |
| 79 | {"type": "code_interpreter"}, |
| 80 | {"type": "code_interpreter"}, |
| 81 | {"type": "code_interpreter"}, |
| 82 | ], |
| 83 | }, |
| 84 | { |
| 85 | "file_id": "string", |
| 86 | "tools": [ |
| 87 | {"type": "code_interpreter"}, |
| 88 | {"type": "code_interpreter"}, |
| 89 | {"type": "code_interpreter"}, |
| 90 | ], |
| 91 | }, |
| 92 | ], |
| 93 | "metadata": {}, |
| 94 | }, |
| 95 | { |
| 96 | "content": "string", |
| 97 | "role": "user", |
| 98 | "attachments": [ |
| 99 | { |
| 100 | "file_id": "string", |
| 101 | "tools": [ |
| 102 | {"type": "code_interpreter"}, |
| 103 | {"type": "code_interpreter"}, |
| 104 | {"type": "code_interpreter"}, |
| 105 | ], |
| 106 | }, |
| 107 | { |
| 108 | "file_id": "string", |
| 109 | "tools": [ |
| 110 | {"type": "code_interpreter"}, |
| 111 | {"type": "code_interpreter"}, |
| 112 | {"type": "code_interpreter"}, |
| 113 | ], |
| 114 | }, |
| 115 | { |
| 116 | "file_id": "string", |
| 117 | "tools": [ |
| 118 | {"type": "code_interpreter"}, |
| 119 | {"type": "code_interpreter"}, |
| 120 | {"type": "code_interpreter"}, |
| 121 | ], |
| 122 | }, |
| 123 | ], |
| 124 | "metadata": {}, |
| 125 | }, |
| 126 | ], |
| 127 | metadata={}, |
| 128 | tool_resources={ |
| 129 | "code_interpreter": {"file_ids": ["string", "string", "string"]}, |
| 130 | "file_search": { |
| 131 | "vector_store_ids": ["string"], |
| 132 | "vector_stores": [ |
| 133 | { |
| 134 | "chunking_strategy": {"type": "auto"}, |
| 135 | "file_ids": ["string", "string", "string"], |
| 136 | "metadata": {}, |
| 137 | } |
| 138 | ], |
| 139 | }, |
| 140 | }, |
| 141 | ) |
| 142 | assert_matches_type(Thread, thread, path=["response"]) |
| 143 | |
| 144 | @parametrize |
| 145 | def test_raw_response_create(self, client: OpenAI) -> None: |
| 146 | response = client.beta.threads.with_raw_response.create() |
| 147 | |
| 148 | assert response.is_closed is True |
| 149 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" |
| 150 | thread = response.parse() |
| 151 | assert_matches_type(Thread, thread, path=["response"]) |
| 152 | |
| 153 | @parametrize |
| 154 | def test_streaming_response_create(self, client: OpenAI) -> None: |
| 155 | with client.beta.threads.with_streaming_response.create() as response: |
| 156 | assert not response.is_closed |
| 157 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" |
| 158 | |
| 159 | thread = response.parse() |
| 160 | assert_matches_type(Thread, thread, path=["response"]) |
| 161 | |
| 162 | assert cast(Any, response.is_closed) is True |
| 163 | |
| 164 | @parametrize |
| 165 | def test_method_retrieve(self, client: OpenAI) -> None: |
| 166 | thread = client.beta.threads.retrieve( |
| 167 | "string", |
| 168 | ) |
| 169 | assert_matches_type(Thread, thread, path=["response"]) |
| 170 | |
| 171 | @parametrize |
| 172 | def test_raw_response_retrieve(self, client: OpenAI) -> None: |
| 173 | response = client.beta.threads.with_raw_response.retrieve( |
| 174 | "string", |
| 175 | ) |
| 176 | |
| 177 | assert response.is_closed is True |
| 178 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" |
| 179 | thread = response.parse() |
| 180 | assert_matches_type(Thread, thread, path=["response"]) |
| 181 | |
| 182 | @parametrize |
| 183 | def test_streaming_response_retrieve(self, client: OpenAI) -> None: |
| 184 | with client.beta.threads.with_streaming_response.retrieve( |
| 185 | "string", |
| 186 | ) as response: |
| 187 | assert not response.is_closed |
| 188 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" |
| 189 | |
| 190 | thread = response.parse() |
| 191 | assert_matches_type(Thread, thread, path=["response"]) |
| 192 | |
| 193 | assert cast(Any, response.is_closed) is True |
| 194 | |
| 195 | @parametrize |
| 196 | def test_path_params_retrieve(self, client: OpenAI) -> None: |
| 197 | with pytest.raises(ValueError, match=r"Expected a non-empty value for `thread_id` but received ''"): |
| 198 | client.beta.threads.with_raw_response.retrieve( |
| 199 | "", |
| 200 | ) |
| 201 | |
| 202 | @parametrize |
| 203 | def test_method_update(self, client: OpenAI) -> None: |
| 204 | thread = client.beta.threads.update( |
| 205 | "string", |
| 206 | ) |
| 207 | assert_matches_type(Thread, thread, path=["response"]) |
| 208 | |
| 209 | @parametrize |
| 210 | def test_method_update_with_all_params(self, client: OpenAI) -> None: |
| 211 | thread = client.beta.threads.update( |
| 212 | "string", |
| 213 | metadata={}, |
| 214 | tool_resources={ |
| 215 | "code_interpreter": {"file_ids": ["string", "string", "string"]}, |
| 216 | "file_search": {"vector_store_ids": ["string"]}, |
| 217 | }, |
| 218 | ) |
| 219 | assert_matches_type(Thread, thread, path=["response"]) |
| 220 | |
| 221 | @parametrize |
| 222 | def test_raw_response_update(self, client: OpenAI) -> None: |
| 223 | response = client.beta.threads.with_raw_response.update( |
| 224 | "string", |
| 225 | ) |
| 226 | |
| 227 | assert response.is_closed is True |
| 228 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" |
| 229 | thread = response.parse() |
| 230 | assert_matches_type(Thread, thread, path=["response"]) |
| 231 | |
| 232 | @parametrize |
| 233 | def test_streaming_response_update(self, client: OpenAI) -> None: |
| 234 | with client.beta.threads.with_streaming_response.update( |
| 235 | "string", |
| 236 | ) as response: |
| 237 | assert not response.is_closed |
| 238 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" |
| 239 | |
| 240 | thread = response.parse() |
| 241 | assert_matches_type(Thread, thread, path=["response"]) |
| 242 | |
| 243 | assert cast(Any, response.is_closed) is True |
| 244 | |
| 245 | @parametrize |
| 246 | def test_path_params_update(self, client: OpenAI) -> None: |
| 247 | with pytest.raises(ValueError, match=r"Expected a non-empty value for `thread_id` but received ''"): |
| 248 | client.beta.threads.with_raw_response.update( |
| 249 | "", |
| 250 | ) |
| 251 | |
| 252 | @parametrize |
| 253 | def test_method_delete(self, client: OpenAI) -> None: |
| 254 | thread = client.beta.threads.delete( |
| 255 | "string", |
| 256 | ) |
| 257 | assert_matches_type(ThreadDeleted, thread, path=["response"]) |
| 258 | |
| 259 | @parametrize |
| 260 | def test_raw_response_delete(self, client: OpenAI) -> None: |
| 261 | response = client.beta.threads.with_raw_response.delete( |
| 262 | "string", |
| 263 | ) |
| 264 | |
| 265 | assert response.is_closed is True |
| 266 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" |
| 267 | thread = response.parse() |
| 268 | assert_matches_type(ThreadDeleted, thread, path=["response"]) |
| 269 | |
| 270 | @parametrize |
| 271 | def test_streaming_response_delete(self, client: OpenAI) -> None: |
| 272 | with client.beta.threads.with_streaming_response.delete( |
| 273 | "string", |
| 274 | ) as response: |
| 275 | assert not response.is_closed |
| 276 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" |
| 277 | |
| 278 | thread = response.parse() |
| 279 | assert_matches_type(ThreadDeleted, thread, path=["response"]) |
| 280 | |
| 281 | assert cast(Any, response.is_closed) is True |
| 282 | |
| 283 | @parametrize |
| 284 | def test_path_params_delete(self, client: OpenAI) -> None: |
| 285 | with pytest.raises(ValueError, match=r"Expected a non-empty value for `thread_id` but received ''"): |
| 286 | client.beta.threads.with_raw_response.delete( |
| 287 | "", |
| 288 | ) |
| 289 | |
| 290 | @parametrize |
| 291 | def test_method_create_and_run_overload_1(self, client: OpenAI) -> None: |
| 292 | thread = client.beta.threads.create_and_run( |
| 293 | assistant_id="string", |
| 294 | ) |
| 295 | assert_matches_type(Run, thread, path=["response"]) |
| 296 | |
| 297 | @parametrize |
| 298 | def test_method_create_and_run_with_all_params_overload_1(self, client: OpenAI) -> None: |
| 299 | thread = client.beta.threads.create_and_run( |
| 300 | assistant_id="string", |
| 301 | instructions="string", |
| 302 | max_completion_tokens=256, |
| 303 | max_prompt_tokens=256, |
| 304 | metadata={}, |
| 305 | model="gpt-4o", |
| 306 | parallel_tool_calls=True, |
| 307 | response_format="auto", |
| 308 | stream=False, |
| 309 | temperature=1, |
| 310 | thread={ |
| 311 | "messages": [ |
| 312 | { |
| 313 | "content": "string", |
| 314 | "role": "user", |
| 315 | "attachments": [ |
| 316 | { |
| 317 | "file_id": "string", |
| 318 | "tools": [ |
| 319 | {"type": "code_interpreter"}, |
| 320 | {"type": "code_interpreter"}, |
| 321 | {"type": "code_interpreter"}, |
| 322 | ], |
| 323 | }, |
| 324 | { |
| 325 | "file_id": "string", |
| 326 | "tools": [ |
| 327 | {"type": "code_interpreter"}, |
| 328 | {"type": "code_interpreter"}, |
| 329 | {"type": "code_interpreter"}, |
| 330 | ], |
| 331 | }, |
| 332 | { |
| 333 | "file_id": "string", |
| 334 | "tools": [ |
| 335 | {"type": "code_interpreter"}, |
| 336 | {"type": "code_interpreter"}, |
| 337 | {"type": "code_interpreter"}, |
| 338 | ], |
| 339 | }, |
| 340 | ], |
| 341 | "metadata": {}, |
| 342 | }, |
| 343 | { |
| 344 | "content": "string", |
| 345 | "role": "user", |
| 346 | "attachments": [ |
| 347 | { |
| 348 | "file_id": "string", |
| 349 | "tools": [ |
| 350 | {"type": "code_interpreter"}, |
| 351 | {"type": "code_interpreter"}, |
| 352 | {"type": "code_interpreter"}, |
| 353 | ], |
| 354 | }, |
| 355 | { |
| 356 | "file_id": "string", |
| 357 | "tools": [ |
| 358 | {"type": "code_interpreter"}, |
| 359 | {"type": "code_interpreter"}, |
| 360 | {"type": "code_interpreter"}, |
| 361 | ], |
| 362 | }, |
| 363 | { |
| 364 | "file_id": "string", |
| 365 | "tools": [ |
| 366 | {"type": "code_interpreter"}, |
| 367 | {"type": "code_interpreter"}, |
| 368 | {"type": "code_interpreter"}, |
| 369 | ], |
| 370 | }, |
| 371 | ], |
| 372 | "metadata": {}, |
| 373 | }, |
| 374 | { |
| 375 | "content": "string", |
| 376 | "role": "user", |
| 377 | "attachments": [ |
| 378 | { |
| 379 | "file_id": "string", |
| 380 | "tools": [ |
| 381 | {"type": "code_interpreter"}, |
| 382 | {"type": "code_interpreter"}, |
| 383 | {"type": "code_interpreter"}, |
| 384 | ], |
| 385 | }, |
| 386 | { |
| 387 | "file_id": "string", |
| 388 | "tools": [ |
| 389 | {"type": "code_interpreter"}, |
| 390 | {"type": "code_interpreter"}, |
| 391 | {"type": "code_interpreter"}, |
| 392 | ], |
| 393 | }, |
| 394 | { |
| 395 | "file_id": "string", |
| 396 | "tools": [ |
| 397 | {"type": "code_interpreter"}, |
| 398 | {"type": "code_interpreter"}, |
| 399 | {"type": "code_interpreter"}, |
| 400 | ], |
| 401 | }, |
| 402 | ], |
| 403 | "metadata": {}, |
| 404 | }, |
| 405 | ], |
| 406 | "metadata": {}, |
| 407 | "tool_resources": { |
| 408 | "code_interpreter": {"file_ids": ["string", "string", "string"]}, |
| 409 | "file_search": { |
| 410 | "vector_store_ids": ["string"], |
| 411 | "vector_stores": [ |
| 412 | { |
| 413 | "chunking_strategy": {"type": "auto"}, |
| 414 | "file_ids": ["string", "string", "string"], |
| 415 | "metadata": {}, |
| 416 | } |
| 417 | ], |
| 418 | }, |
| 419 | }, |
| 420 | }, |
| 421 | tool_choice="none", |
| 422 | tool_resources={ |
| 423 | "code_interpreter": {"file_ids": ["string", "string", "string"]}, |
| 424 | "file_search": {"vector_store_ids": ["string"]}, |
| 425 | }, |
| 426 | tools=[{"type": "code_interpreter"}, {"type": "code_interpreter"}, {"type": "code_interpreter"}], |
| 427 | top_p=1, |
| 428 | truncation_strategy={ |
| 429 | "type": "auto", |
| 430 | "last_messages": 1, |
| 431 | }, |
| 432 | ) |
| 433 | assert_matches_type(Run, thread, path=["response"]) |
| 434 | |
| 435 | @parametrize |
| 436 | def test_raw_response_create_and_run_overload_1(self, client: OpenAI) -> None: |
| 437 | response = client.beta.threads.with_raw_response.create_and_run( |
| 438 | assistant_id="string", |
| 439 | ) |
| 440 | |
| 441 | assert response.is_closed is True |
| 442 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" |
| 443 | thread = response.parse() |
| 444 | assert_matches_type(Run, thread, path=["response"]) |
| 445 | |
| 446 | @parametrize |
| 447 | def test_streaming_response_create_and_run_overload_1(self, client: OpenAI) -> None: |
| 448 | with client.beta.threads.with_streaming_response.create_and_run( |
| 449 | assistant_id="string", |
| 450 | ) as response: |
| 451 | assert not response.is_closed |
| 452 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" |
| 453 | |
| 454 | thread = response.parse() |
| 455 | assert_matches_type(Run, thread, path=["response"]) |
| 456 | |
| 457 | assert cast(Any, response.is_closed) is True |
| 458 | |
| 459 | @parametrize |
| 460 | def test_method_create_and_run_overload_2(self, client: OpenAI) -> None: |
| 461 | thread_stream = client.beta.threads.create_and_run( |
| 462 | assistant_id="string", |
| 463 | stream=True, |
| 464 | ) |
| 465 | thread_stream.response.close() |
| 466 | |
| 467 | @parametrize |
| 468 | def test_method_create_and_run_with_all_params_overload_2(self, client: OpenAI) -> None: |
| 469 | thread_stream = client.beta.threads.create_and_run( |
| 470 | assistant_id="string", |
| 471 | stream=True, |
| 472 | instructions="string", |
| 473 | max_completion_tokens=256, |
| 474 | max_prompt_tokens=256, |
| 475 | metadata={}, |
| 476 | model="gpt-4o", |
| 477 | parallel_tool_calls=True, |
| 478 | response_format="auto", |
| 479 | temperature=1, |
| 480 | thread={ |
| 481 | "messages": [ |
| 482 | { |
| 483 | "content": "string", |
| 484 | "role": "user", |
| 485 | "attachments": [ |
| 486 | { |
| 487 | "file_id": "string", |
| 488 | "tools": [ |
| 489 | {"type": "code_interpreter"}, |
| 490 | {"type": "code_interpreter"}, |
| 491 | {"type": "code_interpreter"}, |
| 492 | ], |
| 493 | }, |
| 494 | { |
| 495 | "file_id": "string", |
| 496 | "tools": [ |
| 497 | {"type": "code_interpreter"}, |
| 498 | {"type": "code_interpreter"}, |
| 499 | {"type": "code_interpreter"}, |
| 500 | ], |
| 501 | }, |
| 502 | { |
| 503 | "file_id": "string", |
| 504 | "tools": [ |
| 505 | {"type": "code_interpreter"}, |
| 506 | {"type": "code_interpreter"}, |
| 507 | {"type": "code_interpreter"}, |
| 508 | ], |
| 509 | }, |
| 510 | ], |
| 511 | "metadata": {}, |
| 512 | }, |
| 513 | { |
| 514 | "content": "string", |
| 515 | "role": "user", |
| 516 | "attachments": [ |
| 517 | { |
| 518 | "file_id": "string", |
| 519 | "tools": [ |
| 520 | {"type": "code_interpreter"}, |
| 521 | {"type": "code_interpreter"}, |
| 522 | {"type": "code_interpreter"}, |
| 523 | ], |
| 524 | }, |
| 525 | { |
| 526 | "file_id": "string", |
| 527 | "tools": [ |
| 528 | {"type": "code_interpreter"}, |
| 529 | {"type": "code_interpreter"}, |
| 530 | {"type": "code_interpreter"}, |
| 531 | ], |
| 532 | }, |
| 533 | { |
| 534 | "file_id": "string", |
| 535 | "tools": [ |
| 536 | {"type": "code_interpreter"}, |
| 537 | {"type": "code_interpreter"}, |
| 538 | {"type": "code_interpreter"}, |
| 539 | ], |
| 540 | }, |
| 541 | ], |
| 542 | "metadata": {}, |
| 543 | }, |
| 544 | { |
| 545 | "content": "string", |
| 546 | "role": "user", |
| 547 | "attachments": [ |
| 548 | { |
| 549 | "file_id": "string", |
| 550 | "tools": [ |
| 551 | {"type": "code_interpreter"}, |
| 552 | {"type": "code_interpreter"}, |
| 553 | {"type": "code_interpreter"}, |
| 554 | ], |
| 555 | }, |
| 556 | { |
| 557 | "file_id": "string", |
| 558 | "tools": [ |
| 559 | {"type": "code_interpreter"}, |
| 560 | {"type": "code_interpreter"}, |
| 561 | {"type": "code_interpreter"}, |
| 562 | ], |
| 563 | }, |
| 564 | { |
| 565 | "file_id": "string", |
| 566 | "tools": [ |
| 567 | {"type": "code_interpreter"}, |
| 568 | {"type": "code_interpreter"}, |
| 569 | {"type": "code_interpreter"}, |
| 570 | ], |
| 571 | }, |
| 572 | ], |
| 573 | "metadata": {}, |
| 574 | }, |
| 575 | ], |
| 576 | "metadata": {}, |
| 577 | "tool_resources": { |
| 578 | "code_interpreter": {"file_ids": ["string", "string", "string"]}, |
| 579 | "file_search": { |
| 580 | "vector_store_ids": ["string"], |
| 581 | "vector_stores": [ |
| 582 | { |
| 583 | "chunking_strategy": {"type": "auto"}, |
| 584 | "file_ids": ["string", "string", "string"], |
| 585 | "metadata": {}, |
| 586 | } |
| 587 | ], |
| 588 | }, |
| 589 | }, |
| 590 | }, |
| 591 | tool_choice="none", |
| 592 | tool_resources={ |
| 593 | "code_interpreter": {"file_ids": ["string", "string", "string"]}, |
| 594 | "file_search": {"vector_store_ids": ["string"]}, |
| 595 | }, |
| 596 | tools=[{"type": "code_interpreter"}, {"type": "code_interpreter"}, {"type": "code_interpreter"}], |
| 597 | top_p=1, |
| 598 | truncation_strategy={ |
| 599 | "type": "auto", |
| 600 | "last_messages": 1, |
| 601 | }, |
| 602 | ) |
| 603 | thread_stream.response.close() |
| 604 | |
| 605 | @parametrize |
| 606 | def test_raw_response_create_and_run_overload_2(self, client: OpenAI) -> None: |
| 607 | response = client.beta.threads.with_raw_response.create_and_run( |
| 608 | assistant_id="string", |
| 609 | stream=True, |
| 610 | ) |
| 611 | |
| 612 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" |
| 613 | stream = response.parse() |
| 614 | stream.close() |
| 615 | |
| 616 | @parametrize |
| 617 | def test_streaming_response_create_and_run_overload_2(self, client: OpenAI) -> None: |
| 618 | with client.beta.threads.with_streaming_response.create_and_run( |
| 619 | assistant_id="string", |
| 620 | stream=True, |
| 621 | ) as response: |
| 622 | assert not response.is_closed |
| 623 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" |
| 624 | |
| 625 | stream = response.parse() |
| 626 | stream.close() |
| 627 | |
| 628 | assert cast(Any, response.is_closed) is True |
| 629 | |
| 630 | |
| 631 | class TestAsyncThreads: |
| 632 | parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) |
| 633 | |
| 634 | @parametrize |
| 635 | async def test_method_create(self, async_client: AsyncOpenAI) -> None: |
| 636 | thread = await async_client.beta.threads.create() |
| 637 | assert_matches_type(Thread, thread, path=["response"]) |
| 638 | |
| 639 | @parametrize |
| 640 | async def test_method_create_with_all_params(self, async_client: AsyncOpenAI) -> None: |
| 641 | thread = await async_client.beta.threads.create( |
| 642 | messages=[ |
| 643 | { |
| 644 | "content": "string", |
| 645 | "role": "user", |
| 646 | "attachments": [ |
| 647 | { |
| 648 | "file_id": "string", |
| 649 | "tools": [ |
| 650 | {"type": "code_interpreter"}, |
| 651 | {"type": "code_interpreter"}, |
| 652 | {"type": "code_interpreter"}, |
| 653 | ], |
| 654 | }, |
| 655 | { |
| 656 | "file_id": "string", |
| 657 | "tools": [ |
| 658 | {"type": "code_interpreter"}, |
| 659 | {"type": "code_interpreter"}, |
| 660 | {"type": "code_interpreter"}, |
| 661 | ], |
| 662 | }, |
| 663 | { |
| 664 | "file_id": "string", |
| 665 | "tools": [ |
| 666 | {"type": "code_interpreter"}, |
| 667 | {"type": "code_interpreter"}, |
| 668 | {"type": "code_interpreter"}, |
| 669 | ], |
| 670 | }, |
| 671 | ], |
| 672 | "metadata": {}, |
| 673 | }, |
| 674 | { |
| 675 | "content": "string", |
| 676 | "role": "user", |
| 677 | "attachments": [ |
| 678 | { |
| 679 | "file_id": "string", |
| 680 | "tools": [ |
| 681 | {"type": "code_interpreter"}, |
| 682 | {"type": "code_interpreter"}, |
| 683 | {"type": "code_interpreter"}, |
| 684 | ], |
| 685 | }, |
| 686 | { |
| 687 | "file_id": "string", |
| 688 | "tools": [ |
| 689 | {"type": "code_interpreter"}, |
| 690 | {"type": "code_interpreter"}, |
| 691 | {"type": "code_interpreter"}, |
| 692 | ], |
| 693 | }, |
| 694 | { |
| 695 | "file_id": "string", |
| 696 | "tools": [ |
| 697 | {"type": "code_interpreter"}, |
| 698 | {"type": "code_interpreter"}, |
| 699 | {"type": "code_interpreter"}, |
| 700 | ], |
| 701 | }, |
| 702 | ], |
| 703 | "metadata": {}, |
| 704 | }, |
| 705 | { |
| 706 | "content": "string", |
| 707 | "role": "user", |
| 708 | "attachments": [ |
| 709 | { |
| 710 | "file_id": "string", |
| 711 | "tools": [ |
| 712 | {"type": "code_interpreter"}, |
| 713 | {"type": "code_interpreter"}, |
| 714 | {"type": "code_interpreter"}, |
| 715 | ], |
| 716 | }, |
| 717 | { |
| 718 | "file_id": "string", |
| 719 | "tools": [ |
| 720 | {"type": "code_interpreter"}, |
| 721 | {"type": "code_interpreter"}, |
| 722 | {"type": "code_interpreter"}, |
| 723 | ], |
| 724 | }, |
| 725 | { |
| 726 | "file_id": "string", |
| 727 | "tools": [ |
| 728 | {"type": "code_interpreter"}, |
| 729 | {"type": "code_interpreter"}, |
| 730 | {"type": "code_interpreter"}, |
| 731 | ], |
| 732 | }, |
| 733 | ], |
| 734 | "metadata": {}, |
| 735 | }, |
| 736 | ], |
| 737 | metadata={}, |
| 738 | tool_resources={ |
| 739 | "code_interpreter": {"file_ids": ["string", "string", "string"]}, |
| 740 | "file_search": { |
| 741 | "vector_store_ids": ["string"], |
| 742 | "vector_stores": [ |
| 743 | { |
| 744 | "chunking_strategy": {"type": "auto"}, |
| 745 | "file_ids": ["string", "string", "string"], |
| 746 | "metadata": {}, |
| 747 | } |
| 748 | ], |
| 749 | }, |
| 750 | }, |
| 751 | ) |
| 752 | assert_matches_type(Thread, thread, path=["response"]) |
| 753 | |
| 754 | @parametrize |
| 755 | async def test_raw_response_create(self, async_client: AsyncOpenAI) -> None: |
| 756 | response = await async_client.beta.threads.with_raw_response.create() |
| 757 | |
| 758 | assert response.is_closed is True |
| 759 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" |
| 760 | thread = response.parse() |
| 761 | assert_matches_type(Thread, thread, path=["response"]) |
| 762 | |
| 763 | @parametrize |
| 764 | async def test_streaming_response_create(self, async_client: AsyncOpenAI) -> None: |
| 765 | async with async_client.beta.threads.with_streaming_response.create() as response: |
| 766 | assert not response.is_closed |
| 767 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" |
| 768 | |
| 769 | thread = await response.parse() |
| 770 | assert_matches_type(Thread, thread, path=["response"]) |
| 771 | |
| 772 | assert cast(Any, response.is_closed) is True |
| 773 | |
| 774 | @parametrize |
| 775 | async def test_method_retrieve(self, async_client: AsyncOpenAI) -> None: |
| 776 | thread = await async_client.beta.threads.retrieve( |
| 777 | "string", |
| 778 | ) |
| 779 | assert_matches_type(Thread, thread, path=["response"]) |
| 780 | |
| 781 | @parametrize |
| 782 | async def test_raw_response_retrieve(self, async_client: AsyncOpenAI) -> None: |
| 783 | response = await async_client.beta.threads.with_raw_response.retrieve( |
| 784 | "string", |
| 785 | ) |
| 786 | |
| 787 | assert response.is_closed is True |
| 788 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" |
| 789 | thread = response.parse() |
| 790 | assert_matches_type(Thread, thread, path=["response"]) |
| 791 | |
| 792 | @parametrize |
| 793 | async def test_streaming_response_retrieve(self, async_client: AsyncOpenAI) -> None: |
| 794 | async with async_client.beta.threads.with_streaming_response.retrieve( |
| 795 | "string", |
| 796 | ) as response: |
| 797 | assert not response.is_closed |
| 798 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" |
| 799 | |
| 800 | thread = await response.parse() |
| 801 | assert_matches_type(Thread, thread, path=["response"]) |
| 802 | |
| 803 | assert cast(Any, response.is_closed) is True |
| 804 | |
| 805 | @parametrize |
| 806 | async def test_path_params_retrieve(self, async_client: AsyncOpenAI) -> None: |
| 807 | with pytest.raises(ValueError, match=r"Expected a non-empty value for `thread_id` but received ''"): |
| 808 | await async_client.beta.threads.with_raw_response.retrieve( |
| 809 | "", |
| 810 | ) |
| 811 | |
| 812 | @parametrize |
| 813 | async def test_method_update(self, async_client: AsyncOpenAI) -> None: |
| 814 | thread = await async_client.beta.threads.update( |
| 815 | "string", |
| 816 | ) |
| 817 | assert_matches_type(Thread, thread, path=["response"]) |
| 818 | |
| 819 | @parametrize |
| 820 | async def test_method_update_with_all_params(self, async_client: AsyncOpenAI) -> None: |
| 821 | thread = await async_client.beta.threads.update( |
| 822 | "string", |
| 823 | metadata={}, |
| 824 | tool_resources={ |
| 825 | "code_interpreter": {"file_ids": ["string", "string", "string"]}, |
| 826 | "file_search": {"vector_store_ids": ["string"]}, |
| 827 | }, |
| 828 | ) |
| 829 | assert_matches_type(Thread, thread, path=["response"]) |
| 830 | |
| 831 | @parametrize |
| 832 | async def test_raw_response_update(self, async_client: AsyncOpenAI) -> None: |
| 833 | response = await async_client.beta.threads.with_raw_response.update( |
| 834 | "string", |
| 835 | ) |
| 836 | |
| 837 | assert response.is_closed is True |
| 838 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" |
| 839 | thread = response.parse() |
| 840 | assert_matches_type(Thread, thread, path=["response"]) |
| 841 | |
| 842 | @parametrize |
| 843 | async def test_streaming_response_update(self, async_client: AsyncOpenAI) -> None: |
| 844 | async with async_client.beta.threads.with_streaming_response.update( |
| 845 | "string", |
| 846 | ) as response: |
| 847 | assert not response.is_closed |
| 848 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" |
| 849 | |
| 850 | thread = await response.parse() |
| 851 | assert_matches_type(Thread, thread, path=["response"]) |
| 852 | |
| 853 | assert cast(Any, response.is_closed) is True |
| 854 | |
| 855 | @parametrize |
| 856 | async def test_path_params_update(self, async_client: AsyncOpenAI) -> None: |
| 857 | with pytest.raises(ValueError, match=r"Expected a non-empty value for `thread_id` but received ''"): |
| 858 | await async_client.beta.threads.with_raw_response.update( |
| 859 | "", |
| 860 | ) |
| 861 | |
| 862 | @parametrize |
| 863 | async def test_method_delete(self, async_client: AsyncOpenAI) -> None: |
| 864 | thread = await async_client.beta.threads.delete( |
| 865 | "string", |
| 866 | ) |
| 867 | assert_matches_type(ThreadDeleted, thread, path=["response"]) |
| 868 | |
| 869 | @parametrize |
| 870 | async def test_raw_response_delete(self, async_client: AsyncOpenAI) -> None: |
| 871 | response = await async_client.beta.threads.with_raw_response.delete( |
| 872 | "string", |
| 873 | ) |
| 874 | |
| 875 | assert response.is_closed is True |
| 876 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" |
| 877 | thread = response.parse() |
| 878 | assert_matches_type(ThreadDeleted, thread, path=["response"]) |
| 879 | |
| 880 | @parametrize |
| 881 | async def test_streaming_response_delete(self, async_client: AsyncOpenAI) -> None: |
| 882 | async with async_client.beta.threads.with_streaming_response.delete( |
| 883 | "string", |
| 884 | ) as response: |
| 885 | assert not response.is_closed |
| 886 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" |
| 887 | |
| 888 | thread = await response.parse() |
| 889 | assert_matches_type(ThreadDeleted, thread, path=["response"]) |
| 890 | |
| 891 | assert cast(Any, response.is_closed) is True |
| 892 | |
| 893 | @parametrize |
| 894 | async def test_path_params_delete(self, async_client: AsyncOpenAI) -> None: |
| 895 | with pytest.raises(ValueError, match=r"Expected a non-empty value for `thread_id` but received ''"): |
| 896 | await async_client.beta.threads.with_raw_response.delete( |
| 897 | "", |
| 898 | ) |
| 899 | |
| 900 | @parametrize |
| 901 | async def test_method_create_and_run_overload_1(self, async_client: AsyncOpenAI) -> None: |
| 902 | thread = await async_client.beta.threads.create_and_run( |
| 903 | assistant_id="string", |
| 904 | ) |
| 905 | assert_matches_type(Run, thread, path=["response"]) |
| 906 | |
| 907 | @parametrize |
| 908 | async def test_method_create_and_run_with_all_params_overload_1(self, async_client: AsyncOpenAI) -> None: |
| 909 | thread = await async_client.beta.threads.create_and_run( |
| 910 | assistant_id="string", |
| 911 | instructions="string", |
| 912 | max_completion_tokens=256, |
| 913 | max_prompt_tokens=256, |
| 914 | metadata={}, |
| 915 | model="gpt-4o", |
| 916 | parallel_tool_calls=True, |
| 917 | response_format="auto", |
| 918 | stream=False, |
| 919 | temperature=1, |
| 920 | thread={ |
| 921 | "messages": [ |
| 922 | { |
| 923 | "content": "string", |
| 924 | "role": "user", |
| 925 | "attachments": [ |
| 926 | { |
| 927 | "file_id": "string", |
| 928 | "tools": [ |
| 929 | {"type": "code_interpreter"}, |
| 930 | {"type": "code_interpreter"}, |
| 931 | {"type": "code_interpreter"}, |
| 932 | ], |
| 933 | }, |
| 934 | { |
| 935 | "file_id": "string", |
| 936 | "tools": [ |
| 937 | {"type": "code_interpreter"}, |
| 938 | {"type": "code_interpreter"}, |
| 939 | {"type": "code_interpreter"}, |
| 940 | ], |
| 941 | }, |
| 942 | { |
| 943 | "file_id": "string", |
| 944 | "tools": [ |
| 945 | {"type": "code_interpreter"}, |
| 946 | {"type": "code_interpreter"}, |
| 947 | {"type": "code_interpreter"}, |
| 948 | ], |
| 949 | }, |
| 950 | ], |
| 951 | "metadata": {}, |
| 952 | }, |
| 953 | { |
| 954 | "content": "string", |
| 955 | "role": "user", |
| 956 | "attachments": [ |
| 957 | { |
| 958 | "file_id": "string", |
| 959 | "tools": [ |
| 960 | {"type": "code_interpreter"}, |
| 961 | {"type": "code_interpreter"}, |
| 962 | {"type": "code_interpreter"}, |
| 963 | ], |
| 964 | }, |
| 965 | { |
| 966 | "file_id": "string", |
| 967 | "tools": [ |
| 968 | {"type": "code_interpreter"}, |
| 969 | {"type": "code_interpreter"}, |
| 970 | {"type": "code_interpreter"}, |
| 971 | ], |
| 972 | }, |
| 973 | { |
| 974 | "file_id": "string", |
| 975 | "tools": [ |
| 976 | {"type": "code_interpreter"}, |
| 977 | {"type": "code_interpreter"}, |
| 978 | {"type": "code_interpreter"}, |
| 979 | ], |
| 980 | }, |
| 981 | ], |
| 982 | "metadata": {}, |
| 983 | }, |
| 984 | { |
| 985 | "content": "string", |
| 986 | "role": "user", |
| 987 | "attachments": [ |
| 988 | { |
| 989 | "file_id": "string", |
| 990 | "tools": [ |
| 991 | {"type": "code_interpreter"}, |
| 992 | {"type": "code_interpreter"}, |
| 993 | {"type": "code_interpreter"}, |
| 994 | ], |
| 995 | }, |
| 996 | { |
| 997 | "file_id": "string", |
| 998 | "tools": [ |
| 999 | {"type": "code_interpreter"}, |
| 1000 | {"type": "code_interpreter"}, |
| 1001 | {"type": "code_interpreter"}, |
| 1002 | ], |
| 1003 | }, |
| 1004 | { |
| 1005 | "file_id": "string", |
| 1006 | "tools": [ |
| 1007 | {"type": "code_interpreter"}, |
| 1008 | {"type": "code_interpreter"}, |
| 1009 | {"type": "code_interpreter"}, |
| 1010 | ], |
| 1011 | }, |
| 1012 | ], |
| 1013 | "metadata": {}, |
| 1014 | }, |
| 1015 | ], |
| 1016 | "metadata": {}, |
| 1017 | "tool_resources": { |
| 1018 | "code_interpreter": {"file_ids": ["string", "string", "string"]}, |
| 1019 | "file_search": { |
| 1020 | "vector_store_ids": ["string"], |
| 1021 | "vector_stores": [ |
| 1022 | { |
| 1023 | "chunking_strategy": {"type": "auto"}, |
| 1024 | "file_ids": ["string", "string", "string"], |
| 1025 | "metadata": {}, |
| 1026 | } |
| 1027 | ], |
| 1028 | }, |
| 1029 | }, |
| 1030 | }, |
| 1031 | tool_choice="none", |
| 1032 | tool_resources={ |
| 1033 | "code_interpreter": {"file_ids": ["string", "string", "string"]}, |
| 1034 | "file_search": {"vector_store_ids": ["string"]}, |
| 1035 | }, |
| 1036 | tools=[{"type": "code_interpreter"}, {"type": "code_interpreter"}, {"type": "code_interpreter"}], |
| 1037 | top_p=1, |
| 1038 | truncation_strategy={ |
| 1039 | "type": "auto", |
| 1040 | "last_messages": 1, |
| 1041 | }, |
| 1042 | ) |
| 1043 | assert_matches_type(Run, thread, path=["response"]) |
| 1044 | |
| 1045 | @parametrize |
| 1046 | async def test_raw_response_create_and_run_overload_1(self, async_client: AsyncOpenAI) -> None: |
| 1047 | response = await async_client.beta.threads.with_raw_response.create_and_run( |
| 1048 | assistant_id="string", |
| 1049 | ) |
| 1050 | |
| 1051 | assert response.is_closed is True |
| 1052 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" |
| 1053 | thread = response.parse() |
| 1054 | assert_matches_type(Run, thread, path=["response"]) |
| 1055 | |
| 1056 | @parametrize |
| 1057 | async def test_streaming_response_create_and_run_overload_1(self, async_client: AsyncOpenAI) -> None: |
| 1058 | async with async_client.beta.threads.with_streaming_response.create_and_run( |
| 1059 | assistant_id="string", |
| 1060 | ) as response: |
| 1061 | assert not response.is_closed |
| 1062 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" |
| 1063 | |
| 1064 | thread = await response.parse() |
| 1065 | assert_matches_type(Run, thread, path=["response"]) |
| 1066 | |
| 1067 | assert cast(Any, response.is_closed) is True |
| 1068 | |
| 1069 | @parametrize |
| 1070 | async def test_method_create_and_run_overload_2(self, async_client: AsyncOpenAI) -> None: |
| 1071 | thread_stream = await async_client.beta.threads.create_and_run( |
| 1072 | assistant_id="string", |
| 1073 | stream=True, |
| 1074 | ) |
| 1075 | await thread_stream.response.aclose() |
| 1076 | |
| 1077 | @parametrize |
| 1078 | async def test_method_create_and_run_with_all_params_overload_2(self, async_client: AsyncOpenAI) -> None: |
| 1079 | thread_stream = await async_client.beta.threads.create_and_run( |
| 1080 | assistant_id="string", |
| 1081 | stream=True, |
| 1082 | instructions="string", |
| 1083 | max_completion_tokens=256, |
| 1084 | max_prompt_tokens=256, |
| 1085 | metadata={}, |
| 1086 | model="gpt-4o", |
| 1087 | parallel_tool_calls=True, |
| 1088 | response_format="auto", |
| 1089 | temperature=1, |
| 1090 | thread={ |
| 1091 | "messages": [ |
| 1092 | { |
| 1093 | "content": "string", |
| 1094 | "role": "user", |
| 1095 | "attachments": [ |
| 1096 | { |
| 1097 | "file_id": "string", |
| 1098 | "tools": [ |
| 1099 | {"type": "code_interpreter"}, |
| 1100 | {"type": "code_interpreter"}, |
| 1101 | {"type": "code_interpreter"}, |
| 1102 | ], |
| 1103 | }, |
| 1104 | { |
| 1105 | "file_id": "string", |
| 1106 | "tools": [ |
| 1107 | {"type": "code_interpreter"}, |
| 1108 | {"type": "code_interpreter"}, |
| 1109 | {"type": "code_interpreter"}, |
| 1110 | ], |
| 1111 | }, |
| 1112 | { |
| 1113 | "file_id": "string", |
| 1114 | "tools": [ |
| 1115 | {"type": "code_interpreter"}, |
| 1116 | {"type": "code_interpreter"}, |
| 1117 | {"type": "code_interpreter"}, |
| 1118 | ], |
| 1119 | }, |
| 1120 | ], |
| 1121 | "metadata": {}, |
| 1122 | }, |
| 1123 | { |
| 1124 | "content": "string", |
| 1125 | "role": "user", |
| 1126 | "attachments": [ |
| 1127 | { |
| 1128 | "file_id": "string", |
| 1129 | "tools": [ |
| 1130 | {"type": "code_interpreter"}, |
| 1131 | {"type": "code_interpreter"}, |
| 1132 | {"type": "code_interpreter"}, |
| 1133 | ], |
| 1134 | }, |
| 1135 | { |
| 1136 | "file_id": "string", |
| 1137 | "tools": [ |
| 1138 | {"type": "code_interpreter"}, |
| 1139 | {"type": "code_interpreter"}, |
| 1140 | {"type": "code_interpreter"}, |
| 1141 | ], |
| 1142 | }, |
| 1143 | { |
| 1144 | "file_id": "string", |
| 1145 | "tools": [ |
| 1146 | {"type": "code_interpreter"}, |
| 1147 | {"type": "code_interpreter"}, |
| 1148 | {"type": "code_interpreter"}, |
| 1149 | ], |
| 1150 | }, |
| 1151 | ], |
| 1152 | "metadata": {}, |
| 1153 | }, |
| 1154 | { |
| 1155 | "content": "string", |
| 1156 | "role": "user", |
| 1157 | "attachments": [ |
| 1158 | { |
| 1159 | "file_id": "string", |
| 1160 | "tools": [ |
| 1161 | {"type": "code_interpreter"}, |
| 1162 | {"type": "code_interpreter"}, |
| 1163 | {"type": "code_interpreter"}, |
| 1164 | ], |
| 1165 | }, |
| 1166 | { |
| 1167 | "file_id": "string", |
| 1168 | "tools": [ |
| 1169 | {"type": "code_interpreter"}, |
| 1170 | {"type": "code_interpreter"}, |
| 1171 | {"type": "code_interpreter"}, |
| 1172 | ], |
| 1173 | }, |
| 1174 | { |
| 1175 | "file_id": "string", |
| 1176 | "tools": [ |
| 1177 | {"type": "code_interpreter"}, |
| 1178 | {"type": "code_interpreter"}, |
| 1179 | {"type": "code_interpreter"}, |
| 1180 | ], |
| 1181 | }, |
| 1182 | ], |
| 1183 | "metadata": {}, |
| 1184 | }, |
| 1185 | ], |
| 1186 | "metadata": {}, |
| 1187 | "tool_resources": { |
| 1188 | "code_interpreter": {"file_ids": ["string", "string", "string"]}, |
| 1189 | "file_search": { |
| 1190 | "vector_store_ids": ["string"], |
| 1191 | "vector_stores": [ |
| 1192 | { |
| 1193 | "chunking_strategy": {"type": "auto"}, |
| 1194 | "file_ids": ["string", "string", "string"], |
| 1195 | "metadata": {}, |
| 1196 | } |
| 1197 | ], |
| 1198 | }, |
| 1199 | }, |
| 1200 | }, |
| 1201 | tool_choice="none", |
| 1202 | tool_resources={ |
| 1203 | "code_interpreter": {"file_ids": ["string", "string", "string"]}, |
| 1204 | "file_search": {"vector_store_ids": ["string"]}, |
| 1205 | }, |
| 1206 | tools=[{"type": "code_interpreter"}, {"type": "code_interpreter"}, {"type": "code_interpreter"}], |
| 1207 | top_p=1, |
| 1208 | truncation_strategy={ |
| 1209 | "type": "auto", |
| 1210 | "last_messages": 1, |
| 1211 | }, |
| 1212 | ) |
| 1213 | await thread_stream.response.aclose() |
| 1214 | |
| 1215 | @parametrize |
| 1216 | async def test_raw_response_create_and_run_overload_2(self, async_client: AsyncOpenAI) -> None: |
| 1217 | response = await async_client.beta.threads.with_raw_response.create_and_run( |
| 1218 | assistant_id="string", |
| 1219 | stream=True, |
| 1220 | ) |
| 1221 | |
| 1222 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" |
| 1223 | stream = response.parse() |
| 1224 | await stream.close() |
| 1225 | |
| 1226 | @parametrize |
| 1227 | async def test_streaming_response_create_and_run_overload_2(self, async_client: AsyncOpenAI) -> None: |
| 1228 | async with async_client.beta.threads.with_streaming_response.create_and_run( |
| 1229 | assistant_id="string", |
| 1230 | stream=True, |
| 1231 | ) as response: |
| 1232 | assert not response.is_closed |
| 1233 | assert response.http_request.headers.get("X-Stainless-Lang") == "python" |
| 1234 | |
| 1235 | stream = await response.parse() |
| 1236 | await stream.close() |
| 1237 | |
| 1238 | assert cast(Any, response.is_closed) is True |
| 1239 | |