Skip to content

Commit

Permalink
Fix: update test_token_generator()
Browse files Browse the repository at this point in the history
Signed-off-by: Eero Tamminen <eero.t.tamminen@intel.com>
  • Loading branch information
eero-t committed Nov 1, 2024
1 parent 94cd81f commit ce3e4ef
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tests/cores/mega/test_service_orchestrator_streaming.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# SPDX-License-Identifier: Apache-2.0

import json
import time
import unittest

from fastapi.responses import StreamingResponse
Expand Down Expand Up @@ -66,11 +67,12 @@ def test_extract_chunk_str(self):
self.assertEqual(res, "example test.")

def test_token_generator(self):
start = time.time()
sentence = "I write an example test.</s>"
for i in self.service_builder.token_generator(sentence=sentence, is_last=False):
for i in self.service_builder.token_generator(sentence=sentence, token_start=start, is_first=True, is_last=False):
self.assertTrue(i.startswith("data: b'"))

for i in self.service_builder.token_generator(sentence=sentence, is_last=True):
for i in self.service_builder.token_generator(sentence=sentence, token_start=start, is_first=False, is_last=True):
self.assertTrue(i.startswith("data: "))


Expand Down

0 comments on commit ce3e4ef

Please sign in to comment.