Skip to content

Commit 1129e53

Browse files
committed
add ut
1 parent e99a258 commit 1129e53

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

tests/test_models.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -694,3 +694,28 @@ def test_evaluation_row_extra_fields():
694694
assert "eval" in dictionary
695695
assert "accuracy" in dictionary["eval_details"]["metrics"]
696696
assert "test" in dictionary["extra_fields"]
697+
698+
def test_message_with_weight_dump():
699+
example = {
700+
"role": "user",
701+
"content": "Hello, how are you?",
702+
"weight": 0,
703+
}
704+
705+
message = Message(**example)
706+
dictionary = message.model_dump()
707+
assert "weight" in dictionary
708+
assert dictionary["weight"] == 0
709+
710+
def test_message_dump_for_chat_completion_request():
711+
example = {
712+
"role": "user",
713+
"content": "Hello, how are you?",
714+
"weight": 0,
715+
"reasoning_content": "I am thinking about the user's question",
716+
}
717+
message = Message(**example)
718+
dictionary = message.dump_mdoel_for_chat_completion_request()
719+
assert "weight" not in dictionary
720+
assert "reasoning_content" not in dictionary
721+
assert dictionary["content"] == "Hello, how are you?"

0 commit comments

Comments
 (0)