Commit 061ebd63
Changed files (5)
tests/lib/chat/test_completions_streaming.py
@@ -13,6 +13,7 @@ from inline_snapshot import (
external,
snapshot,
outsource, # pyright: ignore[reportUnknownVariableType]
+ get_snapshot_value,
)
import openai
@@ -30,7 +31,7 @@ from openai.lib.streaming.chat import (
)
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")
tests/lib/snapshots.py
@@ -7,11 +7,10 @@ from typing_extensions import TypeVar
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")
tests/lib/utils.py
@@ -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
pyproject.toml
@@ -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",
requirements-dev.lock
@@ -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