Skip to content

Commit 03c89b0

Browse files
author
Pedro Perez de Ayala
committed
Add a test that reproduces the error
1 parent db3afad commit 03c89b0

File tree

3 files changed

+32
-2
lines changed

3 files changed

+32
-2
lines changed

pyproject.toml

+2-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ dependencies = [
3131
"async-timeout>=4.0.3",
3232
"simpleeval>=1.0.0",
3333
"jsonschema>=4.23.0",
34-
"duckduckgo-search>=7.2.1"
34+
"duckduckgo-search>=7.2.1",
35+
"pydantic>=2.10.2",
3536
]
3637

3738
readme = "README.md"

tests/graphs/smart_scraper_openai_test.py

+25
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
import pytest
88
from dotenv import load_dotenv
9+
from pydantic import BaseModel
910

1011
from scrapegraphai.graphs import SmartScraperGraph
1112

@@ -53,3 +54,27 @@ def test_get_execution_info(graph_config):
5354
graph_exec_info = smart_scraper_graph.get_execution_info()
5455

5556
assert graph_exec_info is not None
57+
58+
59+
def test_get_execution_info_with_schema(graph_config):
60+
"""Get the execution info with schema"""
61+
62+
class ProjectSchema(BaseModel):
63+
title: str
64+
description: str
65+
66+
class ProjectListSchema(BaseModel):
67+
projects: list[ProjectSchema]
68+
69+
smart_scraper_graph = SmartScraperGraph(
70+
prompt="List me all the projects with their description.",
71+
source="https://perinim.github.io/projects/",
72+
config=graph_config,
73+
schema=ProjectListSchema,
74+
)
75+
76+
smart_scraper_graph.run()
77+
78+
graph_exec_info = smart_scraper_graph.get_execution_info()
79+
80+
assert graph_exec_info is not None

uv.lock

+5-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)