-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
/
Copy pathscrape_graph_test.py
53 lines (38 loc) · 1.07 KB
/
scrape_graph_test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
"""
Module for testing the scrape graph class
"""
import os
import pytest
from dotenv import load_dotenv
from scrapegraphai.graphs import ScrapeGraph
load_dotenv()
@pytest.fixture
def graph_config():
"""Configuration of the graph"""
openai_key = os.getenv("OPENAI_APIKEY")
return {
"llm": {
"api_key": openai_key,
"model": "openai/gpt-3.5-turbo",
},
"verbose": True,
"headless": False,
}
def test_scraping_pipeline(graph_config):
"""Start of the scraping pipeline"""
scrape_graph = ScrapeGraph(
source="https://perinim.github.io/projects/",
config=graph_config,
)
result = scrape_graph.run()
assert result is not None
assert isinstance(result, list)
def test_get_execution_info(graph_config):
"""Get the execution info"""
scrape_graph = ScrapeGraph(
source="https://perinim.github.io/projects/",
config=graph_config,
)
scrape_graph.run()
graph_exec_info = scrape_graph.get_execution_info()
assert graph_exec_info is not None