MCPcopy Create free account
hub / github.com/OpenDCAI/Paper2Any / test_batch_export

Function test_batch_export

tests/test_trajectory.py:147–179  ·  view source on GitHub ↗

测试批量导出

()

Source from the content-addressed store, hash-verified

145 log.info(f"✓ 已导出 SFT 格式: {filepath}")
146
147def test_batch_export():
148 """测试批量导出"""
149 log.info("=" * 60)
150 log.info("测试 3: 批量导出")
151 log.info("=" * 60)
152
153 # 创建多个轨迹
154 trajectories = []
155
156 for i in range(3):
157 manager = TrajectoryManager()
158 manager.start_recording(inputs={"query": f"任务 {i}"})
159
160 collector = manager.get_collector()
161 collector.on_node_start(f"node_{i}", StepRole.SYSTEM_NODE.value)
162 collector.on_node_end(output={"result": f"output_{i}"})
163
164 request = DFRequest(target=f"任务 {i}")
165 state = DFState(request=request)
166
167 trajectory = manager.stop_recording(state, f"workflow_{i}")
168 trajectories.append(trajectory)
169
170 # 批量导出
171 exporter = TrajectoryExporter()
172
173 # 导出为 JSONL
174 filepath = exporter.export_to_jsonl(trajectories, mode="raw")
175 log.info(f"✓ 批量导出 JSONL: {filepath}")
176
177 # 导出统计信息
178 stats_path = exporter.export_statistics(trajectories)
179 log.info(f"✓ 导出统计信息: {stats_path}")
180
181def test_feedback():
182 """测试用户反馈"""

Callers 1

mainFunction · 0.85

Calls 11

start_recordingMethod · 0.95
get_collectorMethod · 0.95
stop_recordingMethod · 0.95
export_to_jsonlMethod · 0.95
export_statisticsMethod · 0.95
TrajectoryManagerClass · 0.90
DFRequestClass · 0.90
DFStateClass · 0.90
TrajectoryExporterClass · 0.90
on_node_startMethod · 0.80
on_node_endMethod · 0.80

Tested by

no test coverage detected