|
1 |
| -""" |
| 1 | +""" |
2 | 2 | Module for making the tests for ScriptGeneratorGraph
|
3 | 3 | """
|
4 | 4 | import pytest
|
5 | 5 | from scrapegraphai.graphs import ScriptCreatorGraph
|
6 | 6 | from scrapegraphai.utils import prettify_exec_info
|
7 | 7 |
|
8 |
| - |
9 | 8 | @pytest.fixture
|
10 | 9 | def graph_config():
|
11 |
| - """ |
12 |
| - Configuration of the graph |
13 |
| - """ |
14 |
| - return { |
15 |
| - "llm": { |
16 |
| - "model": "ollama/mistral", |
17 |
| - "temperature": 0, |
18 |
| - "format": "json", |
19 |
| - "base_url": "http://localhost:11434", |
20 |
| - "library": "beautifoulsoup", |
21 |
| - }, |
22 |
| - "embeddings": { |
23 |
| - "model": "ollama/nomic-embed-text", |
24 |
| - "temperature": 0, |
25 |
| - "base_url": "http://localhost:11434", |
26 |
| - }, |
27 |
| - "library": "beautifoulsoup" |
28 |
| - } |
29 |
| - |
| 10 | + """ |
| 11 | + Configuration of the graph |
| 12 | + """ |
| 13 | + return { |
| 14 | + "llm": { |
| 15 | + "model": "ollama/mistral", |
| 16 | + "temperature": 0, |
| 17 | + "format": "json", |
| 18 | + "base_url": "http://localhost:11434", |
| 19 | + "library": "beautifulsoup", |
| 20 | + }, |
| 21 | + "embeddings": { |
| 22 | + "model": "ollama/nomic-embed-text", |
| 23 | + "temperature": 0, |
| 24 | + "base_url": "http://localhost:11434", |
| 25 | + }, |
| 26 | + "library": "beautifulsoup" |
| 27 | + } |
30 | 28 |
|
31 | 29 | def test_script_creator_graph(graph_config: dict):
|
32 |
| - """ |
33 |
| - Start of the scraping pipeline |
34 |
| - """ |
35 |
| - smart_scraper_graph = ScriptCreatorGraph( |
36 |
| - prompt="List me all the news with their description.", |
37 |
| - source="https://perinim.github.io/projects", |
38 |
| - config=graph_config |
39 |
| - ) |
40 |
| - |
41 |
| - result = smart_scraper_graph.run() |
42 |
| - |
43 |
| - assert result is not None |
44 |
| - |
45 |
| - graph_exec_info = smart_scraper_graph.get_execution_info() |
46 |
| - |
47 |
| - assert graph_exec_info is not None |
| 30 | + """ |
| 31 | + Test the ScriptCreatorGraph |
| 32 | + """ |
| 33 | + smart_scraper_graph = ScriptCreatorGraph( |
| 34 | + prompt="List me all the news with their description.", |
| 35 | + source="https://perinim.github.io/projects", |
| 36 | + config=graph_config |
| 37 | + ) |
| 38 | + result = smart_scraper_graph.run() |
| 39 | + assert result is not None, "ScriptCreatorGraph execution failed to produce a result." |
| 40 | + graph_exec_info = smart_scraper_graph.get_execution_info() |
| 41 | + assert graph_exec_info is not None, "ScriptCreatorGraph execution info is None." |
| 42 | + prettified_exec_info = prettify_exec_info(graph_exec_info) |
| 43 | + print(prettified_exec_info) |
| 44 | + |
| 45 | + # Perform additional assertions on the result or execution info as needed |
0 commit comments