Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
C
coderai
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexlab
coderai
Commits
04342a42
Commit
04342a42
authored
May 06, 2026
by
Stefy Lanza (nextime / spora )
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: normalize managed sample path matching
parent
e65a6b6f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
66 additions
and
3 deletions
+66
-3
test_manual_multimodal_test_client.py
tests/test_manual_multimodal_test_client.py
+60
-2
manual_multimodal_test_client.py
tools/manual_multimodal_test_client.py
+6
-1
No files found.
tests/test_manual_multimodal_test_client.py
View file @
04342a42
from
pathlib
import
Path
from
tools.manual_multimodal_test_client
import
(
from
tools.manual_multimodal_test_client
import
(
MODE_DEFAULTS
,
MODE_DEFAULTS
,
_download_artifact
,
_download_artifact
,
...
@@ -156,7 +158,7 @@ def test_ensure_sample_file_downloads_missing_managed_default(tmp_path, monkeypa
...
@@ -156,7 +158,7 @@ def test_ensure_sample_file_downloads_missing_managed_default(tmp_path, monkeypa
monkeypatch
.
setattr
(
monkeypatch
.
setattr
(
"tools.manual_multimodal_test_client.SAMPLE_URLS"
,
"tools.manual_multimodal_test_client.SAMPLE_URLS"
,
{
managed_path
.
as_posix
()
:
"https://example.invalid/question-audio.wav"
},
{
"samples/question-audio.wav"
:
"https://example.invalid/question-audio.wav"
},
)
)
monkeypatch
.
setattr
(
monkeypatch
.
setattr
(
"tools.manual_multimodal_test_client.download_default_sample"
,
"tools.manual_multimodal_test_client.download_default_sample"
,
...
@@ -170,6 +172,62 @@ def test_ensure_sample_file_downloads_missing_managed_default(tmp_path, monkeypa
...
@@ -170,6 +172,62 @@ def test_ensure_sample_file_downloads_missing_managed_default(tmp_path, monkeypa
assert
managed_path
.
read_bytes
()
==
b
"audio"
assert
managed_path
.
read_bytes
()
==
b
"audio"
def
test_ensure_sample_file_downloads_missing_managed_default_for_equivalent_path
(
tmp_path
,
monkeypatch
):
project_root
=
tmp_path
/
"project"
project_root
.
mkdir
()
managed_path
=
project_root
/
"samples"
/
"transcription.wav"
downloaded
=
[]
def
fake_download
(
path
):
downloaded
.
append
(
path
)
path
.
parent
.
mkdir
(
parents
=
True
,
exist_ok
=
True
)
path
.
write_bytes
(
b
"wav"
)
return
path
monkeypatch
.
setattr
(
"tools.manual_multimodal_test_client.SAMPLE_URLS"
,
{
"samples/transcription.wav"
:
"https://example.invalid/transcription.wav"
},
)
monkeypatch
.
chdir
(
project_root
)
monkeypatch
.
setattr
(
"tools.manual_multimodal_test_client.download_default_sample"
,
fake_download
,
)
result
=
ensure_sample_file
(
"./samples/transcription.wav"
,
"--audio-file"
)
assert
result
==
Path
(
"samples/transcription.wav"
)
assert
downloaded
==
[
Path
(
"samples/transcription.wav"
)]
assert
managed_path
.
read_bytes
()
==
b
"wav"
def
test_ensure_sample_file_downloads_missing_managed_default_for_absolute_path
(
tmp_path
,
monkeypatch
):
project_root
=
tmp_path
/
"project"
managed_path
=
project_root
/
"samples"
/
"transcription.wav"
downloaded
=
[]
def
fake_download
(
path
):
downloaded
.
append
(
path
)
path
.
parent
.
mkdir
(
parents
=
True
,
exist_ok
=
True
)
path
.
write_bytes
(
b
"wav"
)
return
path
monkeypatch
.
setattr
(
"tools.manual_multimodal_test_client.SAMPLE_URLS"
,
{
"samples/transcription.wav"
:
"https://example.invalid/transcription.wav"
},
)
monkeypatch
.
setattr
(
"tools.manual_multimodal_test_client.download_default_sample"
,
fake_download
,
)
result
=
ensure_sample_file
(
str
(
managed_path
),
"--audio-file"
)
assert
result
==
managed_path
assert
downloaded
==
[
managed_path
]
assert
managed_path
.
read_bytes
()
==
b
"wav"
def
test_build_request_spec_for_llm_uses_chat_completions_payload
(
tmp_path
):
def
test_build_request_spec_for_llm_uses_chat_completions_payload
(
tmp_path
):
config
=
{
config
=
{
"mode"
:
"llm"
,
"mode"
:
"llm"
,
...
@@ -250,7 +308,7 @@ def test_build_request_spec_for_transcription_downloads_missing_managed_default(
...
@@ -250,7 +308,7 @@ def test_build_request_spec_for_transcription_downloads_missing_managed_default(
monkeypatch
.
setattr
(
monkeypatch
.
setattr
(
"tools.manual_multimodal_test_client.SAMPLE_URLS"
,
"tools.manual_multimodal_test_client.SAMPLE_URLS"
,
{
managed_path
.
as_posix
()
:
"https://example.invalid/transcription.wav"
},
{
"samples/transcription.wav"
:
"https://example.invalid/transcription.wav"
},
)
)
monkeypatch
.
setattr
(
monkeypatch
.
setattr
(
"tools.manual_multimodal_test_client.download_default_sample"
,
"tools.manual_multimodal_test_client.download_default_sample"
,
...
...
tools/manual_multimodal_test_client.py
View file @
04342a42
...
@@ -107,7 +107,12 @@ def download_default_sample(path: Path) -> Path:
...
@@ -107,7 +107,12 @@ def download_default_sample(path: Path) -> Path:
def
_managed_sample_key
(
path
:
Path
)
->
str
:
def
_managed_sample_key
(
path
:
Path
)
->
str
:
return
path
.
as_posix
()
path_parts
=
path
.
parts
try
:
samples_index
=
path_parts
.
index
(
"samples"
)
except
ValueError
:
return
path
.
as_posix
()
return
Path
(
*
path_parts
[
samples_index
:])
.
as_posix
()
def
ensure_sample_file
(
path_value
:
str
|
None
,
flag_name
:
str
)
->
Path
:
def
ensure_sample_file
(
path_value
:
str
|
None
,
flag_name
:
str
)
->
Path
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment