Skip to content

Commit

Permalink
Merge pull request #63 from edgenai/chore/issue9
Browse files Browse the repository at this point in the history
Chore/issue9
  • Loading branch information
toschoo committed Feb 15, 2024
2 parents eaac306 + 300228b commit 9c148ec
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 4 deletions.
19 changes: 16 additions & 3 deletions tests/test_audio.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,26 @@ def test_transcriptions():
print(transcription)
print(expected)

assert(type(transcription) is str)
have = transcription.text

d = Levenshtein.distance(transcription, expected)
assert(type(have) is str)

d = Levenshtein.distance(have, expected)
similarity = 100 - ((d / len(expected)) * 100)
print(f"distance: {d} of '{transcription}', similarity: {similarity}")
print(f"distance: {d} of '{have}', similarity: {similarity}")

assert(similarity > 90.0)

def test_transcriptions_status():
try:
status = client.audio.transcriptions.status.create()
except APIConnectionError:
pytest.fail("No connection. Is edgen running?")

model = status.active_model
assert(type(model) is str)
print(model)

if __name__ == "__main__":
test_transcriptions()
test_transcriptions_status()
11 changes: 11 additions & 0 deletions tests/test_chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,16 @@ def test_completions():
assert(type(content) is str)
assert("3" in content)

def test_completions_status():
try:
status = client.chat.completions.status.create()
except APIConnectionError:
pytest.fail("No connection. Is edgen running?")

model = status.active_model
assert(type(model) is str)
print(model)

if __name__ == "__main__":
test_completions_streaming()
test_completions()
2 changes: 1 addition & 1 deletion tests/test_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def test_version():
assert(format_version(version) == expected)

def edgen_version():
finished = subprocess.run(["cargo", "run", "version"], capture_output=True, text=True)
finished = subprocess.run(["target/release/edgen", "version"], capture_output=True, text=True)
version = ''.join(f"{finished.stdout}".splitlines())
return version

Expand Down

0 comments on commit 9c148ec

Please sign in to comment.