MCPcopy Create free account
hub / github.com/ScrapeGraphAI/Scrapegraph-ai / assert_valid_scrape_result

Function assert_valid_scrape_result

tests/fixtures/helpers.py:22–34  ·  view source on GitHub ↗

Assert that a scraping result is valid. Args: result: The scraping result to validate expected_keys: Optional list of keys that should be present

(result: Any, expected_keys: Optional[List[str]] = None)

Source from the content-addressed store, hash-verified

20
21
22def assert_valid_scrape_result(result: Any, expected_keys: Optional[List[str]] = None):
23 """Assert that a scraping result is valid.
24
25 Args:
26 result: The scraping result to validate
27 expected_keys: Optional list of keys that should be present
28 """
29 assert result is not None, "Result should not be None"
30 assert isinstance(result, (dict, str)), f"Result should be dict or str, got {type(result)}"
31
32 if isinstance(result, dict) and expected_keys:
33 for key in expected_keys:
34 assert key in result, f"Expected key '{key}' not found in result"
35
36
37def assert_execution_info_valid(exec_info: Dict[str, Any]):

Calls

no outgoing calls