Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ dependencies = [
"sniffio",
"tqdm > 4",
"jiter>=0.4.0, <1",
"inline-snapshot>=0.28.0",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be in dev deps 😅

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ohhh scary mistake, ty, good catch!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved to dev deps!

]
requires-python = ">= 3.8"
classifiers = [
Expand Down
3 changes: 2 additions & 1 deletion requirements-dev.lock
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ idna==3.4
importlib-metadata==7.0.0
iniconfig==2.0.0
# via pytest
inline-snapshot==0.27.0
inline-snapshot==0.28.0
# via openai
jiter==0.5.0
# via openai
markdown-it-py==3.0.0
Expand Down
27 changes: 27 additions & 0 deletions requirements.lock
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ annotated-types==0.6.0
anyio==4.1.0
# via httpx
# via openai
asttokens==3.0.0
# via inline-snapshot
async-timeout==5.0.1
# via aiohttp
attrs==25.3.0
Expand All @@ -35,6 +37,9 @@ distro==1.8.0
# via openai
exceptiongroup==1.2.2
# via anyio
# via pytest
executing==2.2.0
# via inline-snapshot
frozenlist==1.7.0
# via aiohttp
# via aiosignal
Expand All @@ -51,19 +56,31 @@ idna==3.4
# via anyio
# via httpx
# via yarl
iniconfig==2.1.0
# via pytest
inline-snapshot==0.28.0
# via openai
jiter==0.6.1
# via openai
markdown-it-py==3.0.0
# via rich
mdurl==0.1.2
# via markdown-it-py
multidict==6.5.0
# via aiohttp
# via yarl
numpy==2.0.2
# via openai
# via pandas
# via pandas-stubs
packaging==25.0
# via pytest
pandas==2.2.3
# via openai
pandas-stubs==2.2.2.240807
# via openai
pluggy==1.6.0
# via pytest
propcache==0.3.2
# via aiohttp
# via yarl
Expand All @@ -73,17 +90,27 @@ pydantic==2.10.3
# via openai
pydantic-core==2.27.1
# via pydantic
pygments==2.19.2
# via pytest
# via rich
pytest==8.4.1
# via inline-snapshot
python-dateutil==2.9.0.post0
# via pandas
pytz==2024.1
# via pandas
rich==14.1.0
# via inline-snapshot
six==1.16.0
# via python-dateutil
sniffio==1.3.0
# via anyio
# via openai
sounddevice==0.5.1
# via openai
tomli==2.2.1
# via inline-snapshot
# via pytest
tqdm==4.66.5
# via openai
types-pytz==2024.2.0.20241003
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