Commit Graph

44 Commits

Author SHA1 Message Date
Tejas Amol Hande
320f13fa89
Enhance tests for FetchNode with mocking
This commit enhances the test suite for the FetchNode class by introducing mocking for the execute method using the unittest.mock module.

Changes:
- Imported the patch and MagicMock classes from unittest.mock.
- Decorated each test function with @patch('scrapegraphai.nodes.FetchNode.execute') to mock the execute method.
- Set the return_value of the mocked execute method to a MagicMock instance.
- Added assertions to check if the mocked execute method was called with the expected state dictionary.
- Updated the test functions to use the mocked execute method instead of the actual implementation.

Benefits:
- Improved test reliability by isolating the FetchNode class from external dependencies.
- Faster test execution since external resources (e.g., URLs, files) are not required.
- Better test coverage by testing the execute method's behavior with various input states.
- Increased maintainability by decoupling tests from the implementation details of the execute method.

The functionality of the FetchNode class remains unchanged, but the tests now use mocking to ensure the correct behavior of the execute method without relying on external resources or dependencies.
2024-06-07 23:11:32 +05:30
Tejas Amol Hande
d845a1ba7d
test: Enhance JSON scraping pipeline test
This commit enhances the test suite for the JSON scraping pipeline by introducing the following improvements:

- Separate configuration from the test code by loading it from a JSON file (config.json)
- Use a parametrized fixture to run the test with multiple configurations automatically
- Read the sample JSON file from a separate inputs directory for better organization
- Add explicit assertions to verify the expected output (list of titles)
- Improve test organization and separation of concerns using fixtures
- Promote better coding practices and make the test suite more extensible

These changes aim to improve the testability, maintainability, and flexibility of the test suite. They make it easier to manage configurations, add or modify test cases, and ensure the robustness of the scraping pipeline. The test suite now follows best practices and is better prepared for future changes and requirements.
2024-06-07 13:00:54 +05:30
duke147
4e16c9a81d support ernie 2024-06-05 17:37:35 +08:00
Marco Vinciguerra
b913b51cca Merge branch 'logger-integration' into pre/beta 2024-05-24 12:39:14 +02:00
Marco Vinciguerra
3453f72397 add graph 2024-05-17 18:23:50 +02:00
VinciGit00
a4700bfc75 add robot node 2024-05-15 12:00:32 +02:00
VinciGit00
d6f5ca874f Merge branch 'main' into pre/beta 2024-05-14 10:24:29 +02:00
VinciGit00
76b0e39db0 update tests 2024-05-11 12:23:50 +02:00
Federico Minutoli
217013181d feat(proxy-rotation): add parse (IP address) or search (from broker) functionality for proxy rotation
the broker has been made fully configurable for anonymity level, admissible locations, scheme and max shape not to waste resources, unlike the original `free-proxy` package.

other options have been explored (e.g., `proxybroker`, `proxybroker2`) due to their built-in proxy server and rotation capabilities, but the former is no longer maintained, and the latter has issue with any python version outside of python 3.9
2024-05-10 21:09:48 +02:00
Federico Minutoli
db2234bf5d feat(webdriver-backend): add dynamic import scripts from module and file 2024-05-10 21:06:05 +02:00
Marco Vinciguerra
a2d5c75f10
Merge branch 'pre/beta' into main 2024-05-02 17:55:21 +02:00
VinciGit00
5cf4e4f92f fix: examples and graphs 2024-05-02 09:20:46 +02:00
VinciGit00
7c1b5796d7 add csv scraper 2024-05-01 17:20:04 +02:00
VinciGit00
45b2317ab7 add json examples 2024-04-29 11:16:48 +02:00
VinciGit00
9cd516507c fix: bug with fetch node 2024-04-27 21:23:35 +02:00
VinciGit00
a73496df9b refactoring of nodes 2024-04-24 21:13:27 +02:00
EURAC\marperini
ae49dee985 fixed robots_node and add test 2024-04-24 16:12:53 +02:00
VinciGit00
8aa2cadb00 add integration for llama3 2024-04-21 13:11:10 +02:00
VinciGit00
a2349e56af recatoring of nodes excluive for openai 2024-04-19 13:21:48 +02:00
VinciGit00
7815473b6d Update script_generator_test.py 2024-04-19 10:37:22 +02:00
VinciGit00
3f95801737 Merge branch 'main' of https://github.com/VinciGit00/Scrapegraph-ai 2024-04-19 10:36:40 +02:00
VinciGit00
1107630d27 add new test for script generator 2024-04-18 10:39:53 +02:00
Marco Perini
b14527c08d
Merge branch 'main' into refactor_generate_answer_node 2024-04-17 12:08:43 +02:00
Andrea Rota
b0e446f014 feat: apply remove to the document before updating the state 2024-04-17 11:24:56 +02:00
VinciGit00
4a63e2a692 refactoring of the tests 2024-04-16 21:55:13 +02:00
Lorenzo Padoan
d0f4b0159f DEV gemini support for simple custom graph
-Not supported yet smartscrapergrapn with gemini
2024-03-14 19:35:04 +01:00
VinciGit00
a849315182 add new tests and refactoring of code 2024-03-12 21:40:09 +01:00
VinciGit00
5f20299cf3 add tests 2024-03-07 13:22:21 +01:00
VinciGit00
ac692d3aff add readme for tests 2024-03-06 21:21:21 +01:00
VinciGit00
f4d5941831 refctoring of RAG node 2024-02-29 10:29:39 +01:00
VinciGit00
a46f45de14 add tests 2024-02-27 12:07:04 +01:00
VinciGit00
71bd53d254 refactoring of the code, add tests and examples 2024-02-19 11:54:36 +01:00
VinciGit00
074c6faf83 Merge branch 'refactoring-root-folder' 2024-02-15 09:27:50 +01:00
VinciGit00
ce7949de1b refactoring of the folders 2024-02-15 09:27:39 +01:00
VinciGit00
4474d9523d changed link 2024-02-15 09:06:46 +01:00
VinciGit00
2a234f2e4d refactoring of the code changing the name 2024-02-14 20:35:30 +01:00
VinciGit00
ad6574e22d refactoring of token_calculator 2024-02-13 12:35:38 +01:00
VinciGit00
ba2af0b715 add function for saving in csv and json format 2024-02-13 12:30:35 +01:00
VinciGit00
1e7ca9f3fb refactoring of test folder 2024-02-10 19:20:21 +01:00
PeriniM
5312fcaf55 dev: changed library name 2024-02-03 21:42:06 +01:00
PeriniM
787fea0e78 add: readthedocs structure 2024-01-31 16:46:05 +01:00
PeriniM
a9beecde8f add: setup.py for deployment 2024-01-30 15:05:29 +01:00
PeriniM
f367c8919d dev: refactor project structure 2024-01-30 10:36:02 +01:00
VinciGit00
87616018b6 add private class and tests 2024-01-27 21:26:43 +01:00