Test chart generation from data file
()
| 27 | print() |
| 28 | |
| 29 | def test_data_file_chart(): |
| 30 | """Test chart generation from data file""" |
| 31 | print("=" * 60) |
| 32 | print("Test 2: Chart from Data File") |
| 33 | print("=" * 60) |
| 34 | |
| 35 | # Create sample data file |
| 36 | import json |
| 37 | data = { |
| 38 | "products": [ |
| 39 | {"name": "Product A", "sales": 450}, |
| 40 | {"name": "Product B", "sales": 380}, |
| 41 | {"name": "Product C", "sales": 520}, |
| 42 | {"name": "Product D", "sales": 180} |
| 43 | ] |
| 44 | } |
| 45 | |
| 46 | with open("/tmp/sales_data.json", "w") as f: |
| 47 | json.dump(data, f) |
| 48 | |
| 49 | agent = Agent.create("agent.acl") |
| 50 | session = agent.session(".", builtin_skills=True) |
| 51 | |
| 52 | result = session.send(""" |
| 53 | Read /tmp/sales_data.json and create a bar chart |
| 54 | showing product sales. Use vis-chart format. |
| 55 | """) |
| 56 | |
| 57 | print(result.text) |
| 58 | print() |
| 59 | |
| 60 | def test_multiple_charts(): |
| 61 | """Test generating multiple charts""" |
no test coverage detected