ai-agent-book 精选快照(<2MB 代码与文档,来自 github.com/bojieli/ai-agent-book)
Build latest book artifacts / build (push) Canceled after 0s
dependency resolution / resolve (3.11) (push) Canceled after 0s
dependency resolution / resolve (3.13) (push) Canceled after 0s
deploy-pages / build (push) Canceled after 0s
deploy-pages / deploy (push) Canceled after 0s
i18n consistency check / check (push) Canceled after 0s
provider adoption tests / test (chapter2/context-compression) (push) Canceled after 0s
provider adoption tests / test (chapter2/prompt-injection) (push) Canceled after 0s
provider adoption tests / test (chapter2/system-hint) (push) Canceled after 0s
provider adoption tests / test (chapter3/log-sanitization) (push) Canceled after 0s
web-search-agent tests / test (push) Canceled after 0s
web-search-agent tests / agentbook (push) Canceled after 0s
Build latest book artifacts / build (push) Canceled after 0s
dependency resolution / resolve (3.11) (push) Canceled after 0s
dependency resolution / resolve (3.13) (push) Canceled after 0s
deploy-pages / build (push) Canceled after 0s
deploy-pages / deploy (push) Canceled after 0s
i18n consistency check / check (push) Canceled after 0s
provider adoption tests / test (chapter2/context-compression) (push) Canceled after 0s
provider adoption tests / test (chapter2/prompt-injection) (push) Canceled after 0s
provider adoption tests / test (chapter2/system-hint) (push) Canceled after 0s
provider adoption tests / test (chapter3/log-sanitization) (push) Canceled after 0s
web-search-agent tests / test (push) Canceled after 0s
web-search-agent tests / agentbook (push) Canceled after 0s
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
"""Regression test for prepare_animation_data with string or date objects in history_df."""
|
||||
import pandas as pd
|
||||
from animation import prepare_animation_data
|
||||
|
||||
|
||||
def test_prepare_animation_data_string_date():
|
||||
"""prepare_animation_data must handle string dates without raising AttributeError."""
|
||||
history = pd.DataFrame([
|
||||
{
|
||||
"date": "2024-08-01",
|
||||
"model": "model_a",
|
||||
"rating": 1050.0,
|
||||
"rank": 1,
|
||||
"matches": 10,
|
||||
"wins": 7.0,
|
||||
},
|
||||
{
|
||||
"date": "2024-08-01",
|
||||
"model": "model_b",
|
||||
"rating": 950.0,
|
||||
"rank": 2,
|
||||
"matches": 10,
|
||||
"wins": 3.0,
|
||||
},
|
||||
])
|
||||
data = prepare_animation_data(history, top_n=2)
|
||||
assert data["total_frames"] == 1
|
||||
assert data["start_date"] == "2024-08-01"
|
||||
assert data["end_date"] == "2024-08-01"
|
||||
assert len(data["frames"]) == 1
|
||||
assert data["frames"][0]["date"] == "2024-08-01"
|
||||
assert data["frames"][0]["timestamp"] == 1722470400
|
||||
Reference in New Issue
Block a user