Fix schema option not working - Unit Tests #947
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
CodeBeaver PR Summary
I started working from Fix schema option not working
🔄 4 test files added and 7 test files updated to reflect recent changes.
🐛 Found 1 bug
🛠️ 94/133 tests passed
🔄 Test Updates
I've added or updated 8 tests. They all pass ☑️
Updated Tests:
tests/nodes/fetch_node_test.py
🩹tests/nodes/fetch_node_test.py
🩹tests/nodes/fetch_node_test.py
🩹tests/nodes/fetch_node_test.py
🩹tests/graphs/abstract_graph_test.py
🩹tests/graphs/abstract_graph_test.py
🩹tests/utils/test_proxy_rotation.py
🩹New Tests:
tests/test_generate_answer_node.py
🐛 Bug Detection
Potential issues:
scrapegraphai/utils/research_web.py
The error is occurring in the
test_google_search
function. The test is expecting exactly 2 results from thesearch_on_web
function, but it's receiving 4 results instead. This mismatch is causing the assertion to fail.Let's break down the problem:
search_on_web("test query", search_engine="duckduckgo", max_results=2)
.max_results=2
).This suggests that the
search_on_web
function is not correctly limiting the number of results to the specifiedmax_results
parameter when using the DuckDuckGo search engine.The issue is likely in the implementation of the DuckDuckGo search in the
search_on_web
function. Specifically, in this part of the code:The
DuckDuckGoSearchResults
object is created with the correctmax_results
, but the results are then extracted using a regex pattern. This regex extraction might not be respecting themax_results
limit.To fix this, the code should explicitly limit the number of results after the regex extraction:
This change would ensure that no more than
max_results
URLs are returned, regardless of how many are found by the regex.Test Error Log
☂️ Coverage Improvements
Coverage improvements by file:
tests/nodes/fetch_node_test.py
tests/graphs/abstract_graph_test.py
tests/utils/test_proxy_rotation.py
tests/test_generate_answer_node.py
🎨 Final Touches
Settings | Logs | CodeBeaver