()
| 416 | def test_todo_list_tool_write_read_render(self): |
| 417 | |
| 418 | async def main(): |
| 419 | with tempfile.TemporaryDirectory() as td: |
| 420 | cfg = _make_config( |
| 421 | td, |
| 422 | tools={ |
| 423 | 'todo_list': |
| 424 | SimpleNamespace( |
| 425 | plan_filename='plan.json', |
| 426 | plan_md_filename='plan.md', |
| 427 | auto_render_md=True, |
| 428 | ) |
| 429 | }, |
| 430 | ) |
| 431 | tool = TodoListTool(cfg) |
| 432 | await tool.connect() |
| 433 | |
| 434 | tools = await tool.get_tools() |
| 435 | self.assertIn('todo_list', tools) |
| 436 | names = {t['tool_name'] for t in tools['todo_list']} |
| 437 | self.assertEqual(names, |
| 438 | {'todo_write', 'todo_read', 'todo_render_md'}) |
| 439 | |
| 440 | # Write + merge update |
| 441 | res1 = await tool.todo_write( |
| 442 | merge=True, |
| 443 | todos=[{ |
| 444 | 'id': 't1', |
| 445 | 'content': 'do A', |
| 446 | 'status': 'pending', |
| 447 | 'priority': 'high', |
| 448 | }], |
| 449 | ) |
| 450 | data1 = json.loads(res1) |
| 451 | self.assertEqual(data1['status'], 'ok') |
| 452 | self.assertEqual(len(data1['todos']), 1) |
| 453 | |
| 454 | res2 = await tool.todo_write( |
| 455 | merge=True, |
| 456 | todos=[{ |
| 457 | 'id': 't1', |
| 458 | 'content': 'do A', |
| 459 | 'status': 'completed', |
| 460 | 'priority': 'high', |
| 461 | }], |
| 462 | ) |
| 463 | data2 = json.loads(res2) |
| 464 | self.assertEqual(data2['todos'][0]['status'], 'completed') |
| 465 | |
| 466 | # Read |
| 467 | read = await tool.todo_read() |
| 468 | todos = json.loads(read) |
| 469 | self.assertEqual(todos[0]['id'], 't1') |
| 470 | |
| 471 | # Render markdown |
| 472 | msg = await tool.todo_render_md() |
| 473 | self.assertIn('OK: rendered plan markdown', msg) |
| 474 | |
| 475 | # Files exist |
nothing calls this directly
no test coverage detected