Scrapegraph-ai/tests/graphs/script_generator_test.py
Marco Vinciguerra cec5537f2a
Some checks are pending
/ build (push) Waiting to run
Release / Build (push) Waiting to run
Release / Release (push) Blocked by required conditions
add new tests
Co-Authored-By: Matteo Vedovati <68272450+vedovati-matteo@users.noreply.github.com>
2024-08-11 17:10:55 +02:00

35 lines
935 B
Python

"""
Module for making the tests for ScriptGeneratorGraph
"""
import pytest
from scrapegraphai.graphs import ScriptCreatorGraph
from scrapegraphai.utils import prettify_exec_info
@pytest.fixture
def graph_config():
"""
Configuration of the graph
"""
return {
"llm": {
"model": "ollama/mistral",
"temperature": 0,
"format": "json",
"base_url": "http://localhost:11434",
"library": "beautifulsoup",
},
"library": "beautifulsoup"
}
def test_script_creator_graph(graph_config: dict):
"""
Test the ScriptCreatorGraph
"""
smart_scraper_graph = ScriptCreatorGraph(
prompt="List me all the news with their description.",
source="https://perinim.github.io/projects",
config=graph_config
)
result = smart_scraper_graph.run()
assert result is not None, "ScriptCreatorGraph execution failed to produce a result."