Dummy BaseGraph to test _create_graph method without side effects.
| 29 | |
| 30 | |
| 31 | class DummyBaseGraph: |
| 32 | """Dummy BaseGraph to test _create_graph method without side effects.""" |
| 33 | |
| 34 | def __init__(self, nodes, edges, entry_point, graph_name): |
| 35 | self.nodes = nodes |
| 36 | self.edges = edges |
| 37 | self.entry_point = entry_point |
| 38 | self.graph_name = graph_name |
| 39 | |
| 40 | config = { |
| 41 | "llm": {"model": "dummy_model", "model_provider": "dummy_provider"}, |
| 42 | "key": "value", |
| 43 | } |
| 44 | """Test that CSVScraperMultiGraph.run returns the expected answer when provided by the graph.""" |
| 45 | prompt = "Test prompt" |
| 46 | source = ["url1", "url2"] |
| 47 | |
| 48 | # Instantiate the graph |
| 49 | multi_graph = CSVScraperMultiGraph(prompt, source, config) |
| 50 | |
| 51 | # Override the graph attribute with a dummy graph returning an expected answer |
| 52 | multi_graph.graph = DummyGraph("expected answer") |
| 53 | |
| 54 | result = multi_graph.run() |
| 55 | assert result == "expected answer" |
| 56 | |
| 57 | |
| 58 | def test_run_no_answer(): |