-
Notifications
You must be signed in to change notification settings - Fork 260
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
79 additions
and
137 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,34 @@ | ||
from pydoc import cli | ||
from .utils import IN_GITHUB | ||
import time | ||
from random import randint | ||
|
||
from elevenlabs import History, \ | ||
play | ||
|
||
from .utils import IN_GITHUB, client | ||
|
||
def test_history(): | ||
from elevenlabs import History | ||
from elevenlabs.client import ElevenLabs | ||
|
||
client = ElevenLabs() | ||
|
||
def test_history(): | ||
page_size = 5 | ||
# Test that we can get history | ||
history = client.history.get_all(page_size=page_size) | ||
assert isinstance(history, History) | ||
|
||
|
||
def test_history_item_delete(): | ||
import time | ||
from random import randint | ||
|
||
from elevenlabs import generate, play | ||
from elevenlabs.client import ElevenLabs | ||
|
||
# Random text | ||
text = f"Test {randint(0, 1000)}" | ||
audio = generate(text=text) # Generate a history item to delete | ||
audio = client.generate(text=text) | ||
if not IN_GITHUB: | ||
play(audio) | ||
play(audio) # type: ignore | ||
|
||
time.sleep(1) | ||
|
||
client = ElevenLabs() | ||
history = client.history.get_all().history | ||
print(history) | ||
history_item = history[0] | ||
|
||
# Check that item matches | ||
assert history_item.text == text | ||
client.history.delete(history_item.history_item_id) | ||
|
||
# Test that the history item was deleted | ||
history = client.history.get_all(page_size=1).history | ||
assert len(history) == 0 or history[0].text != text | ||
assert len(history) == 0 or history[0].text != text |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.