Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ dev-dependencies = [
"dirty-equals>=0.6.0",
"importlib-metadata>=6.7.0",
"rich>=13.7.1",
"inline-snapshot >=0.7.0",
"inline-snapshot>=0.28.0",
"azure-identity >=1.14.1",
"types-tqdm > 4",
"types-pyaudio > 0",
Expand Down
2 changes: 1 addition & 1 deletion requirements-dev.lock
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ idna==3.4
importlib-metadata==7.0.0
iniconfig==2.0.0
# via pytest
inline-snapshot==0.27.0
inline-snapshot==0.28.0
jiter==0.5.0
# via openai
markdown-it-py==3.0.0
Expand Down
3 changes: 2 additions & 1 deletion tests/lib/chat/test_completions_streaming.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
external,
snapshot,
outsource, # pyright: ignore[reportUnknownVariableType]
get_snapshot_value,
)

import openai
Expand All @@ -30,7 +31,7 @@
)
from openai.lib._parsing._completions import ResponseFormatT

from ..utils import print_obj, get_snapshot_value
from ..utils import print_obj
from ...conftest import base_url

_T = TypeVar("_T")
Expand Down
3 changes: 1 addition & 2 deletions tests/lib/snapshots.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@

import httpx
from respx import MockRouter
from inline_snapshot import get_snapshot_value

from openai import OpenAI, AsyncOpenAI

from .utils import get_snapshot_value

_T = TypeVar("_T")


Expand Down
12 changes: 0 additions & 12 deletions tests/lib/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,3 @@ def get_caller_name(*, stacklevel: int = 1) -> str:
def clear_locals(string: str, *, stacklevel: int) -> str:
caller = get_caller_name(stacklevel=stacklevel + 1)
return string.replace(f"{caller}.<locals>.", "")


def get_snapshot_value(snapshot: Any) -> Any:
if not hasattr(snapshot, "_old_value"):
return snapshot

old = snapshot._old_value
if not hasattr(old, "value"):
return old

loader = getattr(old.value, "_load_value", None)
return loader() if loader else old.value
Loading