mirror of
https://github.com/hwchase17/langchain.git
synced 2026-06-09 10:17:00 +00:00
fix(openai): replace pytest.warns(None) with warnings.catch_warnings in ChatOpenAI test to resolve TypeError . Resolves issue #33705 (#33741)
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import warnings
|
||||
from functools import partial
|
||||
from types import TracebackType
|
||||
from typing import Any, Literal, cast
|
||||
@@ -1199,14 +1200,18 @@ def test__get_request_payload() -> None:
|
||||
|
||||
|
||||
def test_init_o1() -> None:
|
||||
with pytest.warns(None) as record: # type: ignore[call-overload]
|
||||
with warnings.catch_warnings(record=True) as record:
|
||||
warnings.simplefilter("error") # Treat warnings as errors
|
||||
ChatOpenAI(model="o1", reasoning_effort="medium")
|
||||
|
||||
assert len(record) == 0
|
||||
|
||||
|
||||
def test_init_minimal_reasoning_effort() -> None:
|
||||
with pytest.warns(None) as record: # type: ignore[call-overload]
|
||||
with warnings.catch_warnings(record=True) as record:
|
||||
warnings.simplefilter("error")
|
||||
ChatOpenAI(model="gpt-5", reasoning_effort="minimal")
|
||||
|
||||
assert len(record) == 0
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user