-
Notifications
You must be signed in to change notification settings - Fork 162
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
4 changed files
with
74 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import pytest | ||
|
||
from griptape.common import ActionCallDeltaMessageContent | ||
from griptape.events import ActionChunkEvent | ||
|
||
|
||
class TestCompletionChunkEvent: | ||
@pytest.fixture() | ||
def action_chunk_event(self): | ||
return ActionChunkEvent(token="foo bar") | ||
|
||
def test_token(self, action_chunk_event): | ||
assert action_chunk_event.token == "foo bar" | ||
assert action_chunk_event.index == 0 | ||
assert action_chunk_event.tag is None | ||
assert action_chunk_event.name is None | ||
assert action_chunk_event.path is None | ||
|
||
def test_to_dict(self, action_chunk_event): | ||
assert action_chunk_event.to_dict()["token"] == "foo bar" | ||
|
||
def test_from_delta_message_content(self): | ||
content = ActionCallDeltaMessageContent( | ||
index=0, | ||
partial_input="foo bar", | ||
tag="tag", | ||
name="name", | ||
path="path", | ||
) | ||
event = ActionChunkEvent.from_delta_message_content(content) | ||
assert event.token == "foo bar" | ||
assert event.index == 0 | ||
assert event.tag == "tag" | ||
assert event.name == "name" | ||
assert event.path == "path" |
4 changes: 2 additions & 2 deletions
4
...nit/events/test_completion_chunk_event.py → tests/unit/events/test_base_chunk_event.py
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import pytest | ||
|
||
from griptape.common import TextDeltaMessageContent | ||
from griptape.events import TextChunkEvent | ||
|
||
|
||
class TestCompletionChunkEvent: | ||
@pytest.fixture() | ||
def text_chunk_event(self): | ||
return TextChunkEvent(token="foo bar") | ||
|
||
def test_token(self, text_chunk_event): | ||
assert text_chunk_event.token == "foo bar" | ||
|
||
def test_to_dict(self, text_chunk_event): | ||
assert text_chunk_event.to_dict()["token"] == "foo bar" | ||
|
||
def test_from_delta_message_content(self): | ||
content = TextDeltaMessageContent( | ||
index=0, | ||
text="foo bar", | ||
) | ||
event = TextChunkEvent.from_delta_message_content(content) | ||
assert event.token == "foo bar" | ||
assert event.index == 0 |