Skip to content

Commit d1de926

Browse files
committed
Add turn test
1 parent 3c02657 commit d1de926

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

tests/core/types/test_turn.py

+13-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ def test_conversation():
88
role_user = Role.USER
99
role_assistant = Role.ASSISTANT
1010

11-
message1 = Message(role=role_user, content="Hello")
11+
message1 = Message(role=role_user, content="Hello", id="1")
1212
message2 = Message(role=role_assistant, content="Hi, how can I help you?")
1313
message3 = Message(role=role_user, content="I need assistance with my account.")
1414

@@ -62,3 +62,15 @@ def test_filter_messages_with_nonexistent_role(test_conversation):
6262
conversation, _, _, _, _, _ = test_conversation
6363
role_nonexistent = Role.TOOL
6464
assert conversation.filter_messages(role_nonexistent) == []
65+
66+
67+
def test_repr(test_conversation):
68+
conversation, _, _, message1, message2, message3 = test_conversation
69+
assert repr(message1) == "1 - USER: Hello"
70+
assert repr(message2) == "ASSISTANT: Hi, how can I help you?"
71+
assert repr(message3) == "USER: I need assistance with my account."
72+
assert repr(conversation) == (
73+
"1 - USER: Hello\n"
74+
"ASSISTANT: Hi, how can I help you?\n"
75+
"USER: I need assistance with my account."
76+
)

0 commit comments

Comments
 (0)