Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
change
sglang
Commits
5f6fa04a
Unverified
Commit
5f6fa04a
authored
Aug 07, 2024
by
yichuan~
Committed by
GitHub
Aug 07, 2024
Browse files
misc: simplify test (#964)
parent
58a09708
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
16 deletions
+6
-16
test/srt/test_openai_server.py
test/srt/test_openai_server.py
+6
-16
No files found.
test/srt/test_openai_server.py
View file @
5f6fa04a
...
@@ -313,22 +313,12 @@ class TestOpenAIServer(unittest.TestCase):
...
@@ -313,22 +313,12 @@ class TestOpenAIServer(unittest.TestCase):
result_file_id
=
batch_job
.
output_file_id
result_file_id
=
batch_job
.
output_file_id
file_response
=
client
.
files
.
content
(
result_file_id
)
file_response
=
client
.
files
.
content
(
result_file_id
)
result_content
=
file_response
.
read
()
result_content
=
file_response
.
read
().
decode
(
"utf-8"
)
# Decode bytes to string
results
=
[
if
mode
==
"completion"
:
json
.
loads
(
line
)
result_file_name
=
"batch_job_complete_results.jsonl"
for
line
in
result_content
.
split
(
"
\n
"
)
else
:
if
line
.
strip
()
!=
""
result_file_name
=
"batch_job_chat_results.jsonl"
]
with
open
(
result_file_name
,
"wb"
)
as
file
:
file
.
write
(
result_content
)
results
=
[]
with
open
(
result_file_name
,
"r"
,
encoding
=
"utf-8"
)
as
file
:
for
line
in
file
:
json_object
=
json
.
loads
(
line
.
strip
())
results
.
append
(
json_object
)
for
delete_fid
in
[
uploaded_file
.
id
,
result_file_id
]:
del_pesponse
=
client
.
files
.
delete
(
delete_fid
)
assert
del_pesponse
.
deleted
assert
len
(
results
)
==
len
(
content
)
assert
len
(
results
)
==
len
(
content
)
def
test_completion
(
self
):
def
test_completion
(
self
):
...
...
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