Python scraper based on AI
Python ai-crawlerai-scrapingai-searchcrawlerdata-extractionfirecrawl-alternativelarge-language-modelllmmarkdownragscrapingscraping-pythonweb-crawlerweb-crawlersweb-dataweb-data-extractionweb-scraperweb-scrapingweb-searchwebscraping
refactoring of the tests
VinciGit004a63e2a69215
diff --git a/tests/Readme.md b/tests/Readme.mdindex 2c9dbe1d..003d4385 100644--- a/tests/Readme.md+++ b/tests/Readme.md@@ -1,3 +1,10 @@# Test section-Regarding the tests for the folder graphs and nodes it was created a specific repo as a example-([link of the repo](https://github.com/VinciGit00/Scrapegrah-ai-website-for-tests)). The test website is hosted [here](https://scrapegrah-ai-website-for-tests.onrender.com).\ No newline at end of file+All the tests are done in pytest.++## How to run the tests+For runnning the test run:++```+pytest+```+the framework will automatically recognise the test scripts and it will run itdiff --git a/tests/graphs/.env.example b/tests/graphs/.env.exampledeleted file mode 100644index 42454237..00000000--- a/tests/graphs/.env.example+++ /dev/null@@ -1 +0,0 @@-OPENAI_APIKEY="your openai.com api key"\ No newline at end of filediff --git a/tests/graphs/graph_from_text_test.py b/tests/graphs/graph_from_text_test.pydeleted file mode 100644index c222e223..00000000--- a/tests/graphs/graph_from_text_test.py+++ /dev/null@@ -1,93 +0,0 @@-"""-Module for testing the graph_from_text_example-"""-import os-import unittest-from unittest.mock import patch-from scrapegraphai.models import OpenAI-from scrapegraphai.graphs import BaseGraph-from scrapegraphai.nodes import FetchTextNode, ParseNode, RAGNode, GenerateAnswerNodeFromRag---class TestCustomGraph(unittest.TestCase):- """- Test suite for custom graph functionality.- """-- @patch.object(OpenAI, 'generate')- def test_answer_generation(self, mock_generate):- """- Test answer generation functionality.-- Args:- mock_generate (MagicMock): Mocked generate method of OpenAI class.- """- # Mock responses from the RAG and OpenAI models- mock_generate.side_effect = [- ("Here's the answer from the RAG model."),- ("The final refined answer.")- ]-- # Sample text data- test_text = "This is a sample text for testing. It contains some information."-- # Prepare a temporary file- with open('text_example.txt', 'w') as f:- f.write(test_text)-- # Retrieve OpenAI API key from environment variables- openai_key = os.getenv("OPENAI_APIKEY")-- # Check if the key was found- if not openai_key:- raise ValueError(- "OPENAI_APIKEY environment variable not found. Please set it before running.")-- # LLM configuration- llm_config = {- "api_key": openai_key,- "model_name": "gpt-3.5-turbo",- "temperature": 0,- "streaming": True- }-- # Create the OpenAI model instance- model = OpenAI(llm_config)-- # Set up graph structure- fetch_text_node = FetchTextNode("load_html_from_text")- parse_document_node = ParseNode(- doc_type="text", chunks_size=20, node_name="parse_document")- rag_node = RAGNode(model, "rag")- generate_answer_node = GenerateAnswerNodeFromRag(model, "generate_answer")-- graph = BaseGraph(- nodes={- fetch_text_node,- parse_document_node,- rag_node,- generate_answer_node- },- edges={- (fetch_text_node, parse_document_node),- (parse_document_node, rag_node),- (rag_node, generate_answer_node)- },- entry_point=fetch_text_node- )-- # Execute the graph- inputs = {"user_input": "What is the information in this text?",- "text": 'text_example.txt'}- result = graph.execute(inputs)-- # Assert the expected answer- answer = result.get("answer", "No answer found.")- self.assertEqual(answer, "The final refined answer.")-- # Clean up- os.remove('text_example.txt')---if __name__ == '__main__':- unittest.main()diff --git a/tests/graphs/smart_scraper_test.py b/tests/graphs/smart_scraper_test.pydeleted file mode 100644index 6bb56755..00000000--- a/tests/graphs/smart_scraper_test.py+++ /dev/null@@ -1,41 +0,0 @@-"""-Module for testing SmartScraper class-"""-import os-import unittest-from dotenv import load_dotenv-from scrapegraphai.graphs import SmartScraperGraph--load_dotenv()---class TestScrapingPipeline(unittest.TestCase):- """Test class for SmartScraperGraph"""-- def setUp(self):- # Define the configuration for the language model- openai_key = os.getenv("OPENAI_APIKEY")- llm_config = {- "api_key": openai_key,- "model_name": "gpt-3.5-turbo",- }-- # Define URL and PROMPT- url = "https://perinim.github.io/projects/"- prompt = "List me all the titles and project descriptions"-- # Create the SmartScraperGraph instance- self.smart_scraper_graph = SmartScraperGraph(prompt, url, llm_config)-- def test_scraping(self):- """Main test method"""- # Run the scraper- result = self.smart_scraper_graph.run()- print(result)-- # Check if the result is not empty- self.assertNotEqual(result, {})---if __name__ == '__main__':- unittest.main()diff --git a/tests/graphs/speech_summary_test.py b/tests/graphs/speech_summary_test.pydeleted file mode 100644index 79503f2c..00000000--- a/tests/graphs/speech_summary_test.py+++ /dev/null@@ -1,46 +0,0 @@-"""-Module for testing SpeechSummaryGraph-"""-import os-import unittest-from dotenv import load_dotenv-from scrapegraphai.graphs import SpeechSummaryGraph--load_dotenv()---class TestSpeechSummaryGraph(unittest.TestCase):- """Test class for SpeechSummaryGraph"""-- def setUp(self):- # Define the configuration for the language model- openai_key = os.getenv("OPENAI_APIKEY")- llm_config = {- "api_key": openai_key,- }-- # Save the audio to a file- curr_dir = os.path.dirname(os.path.realpath(__file__))- output_file_path = os.path.join(curr_dir, "website_summary.mp3")-- # Initialize SpeechSummaryGraph instance- self.speech_summary_graph = SpeechSummaryGraph(- "Make a summary of the news to be converted to audio for blind people.",- "https://www.wired.com/category/science/",- llm_config,- output_file_path- )-- def test_summary_generation(self):- """Test summary generation and audio conversion"""- # Run the summary graph- final_state = self.speech_summary_graph.run()- print(final_state)-- # Check if the final state contains non-empty 'answer' key- self.assertTrue(final_state.get("answer")- is not None and final_state["answer"] != "")---if __name__ == '__main__':- unittest.main()diff --git a/tests/graphs/text_example.txt b/tests/graphs/text_example.txtdeleted file mode 100644index c76d93df..00000000--- a/tests/graphs/text_example.txt+++ /dev/null@@ -1 +0,0 @@-This is a sample text for testing. It contains some information.\ No newline at end of filediff --git a/tests/inputs/books.xml b/tests/inputs/books.xmlnew file mode 100644index 00000000..e3d1fe87--- /dev/null+++ b/tests/inputs/books.xml@@ -0,0 +1,120 @@+<?xml version="1.0"?>+<catalog>+ <book id="bk101">+ <author>Gambardella, Matthew</author>+ <title>XML Developer's Guide</title>+ <genre>Computer</genre>+ <price>44.95</price>+ <publish_date>2000-10-01</publish_date>+ <description>An in-depth look at creating applications+ with XML.</description>+ </book>+ <book id="bk102">+ <author>Ralls, Kim</author>+ <title>Midnight Rain</title>+ <genre>Fantasy</genre>+ <price>5.95</price>+ <publish_date>2000-12-16</publish_date>+ <description>A former architect battles corporate zombies,+ an evil sorceress, and her own childhood to become queen+ of the world.</description>+ </book>+ <book id="bk103">+ <author>Corets, Eva</author>+ <title>Maeve Ascendant</title>+ <genre>Fantasy</genre>+ <price>5.95</price>+ <publish_date>2000-11-17</publish_date>+ <description>After the collapse of a nanotechnology+ society in England, the young survivors lay the+ foundation for a new society.</description>+ </book>+ <book id="bk104">+ <author>Corets, Eva</author>+ <title>Oberon's Legacy</title>+ <genre>Fantasy</genre>+ <price>5.95</price>+ <publish_date>2001-03-10</publish_date>+ <description>In post-apocalypse England, the mysterious+ agent known only as Oberon helps to create a new life+ for the inhabitants of London. Sequel to Maeve+ Ascendant.</description>+ </book>+ <book id="bk105">+ <author>Corets, Eva</author>+ <title>The Sundered Grail</title>+ <genre>Fantasy</genre>+ <price>5.95</price>+ <publish_date>2001-09-10</publish_date>+ <description>The two daughters of Maeve, half-sisters,+ battle one another for control of England. Sequel to+ Oberon's Legacy.</description>+ </book>+ <book id="bk106">+ <author>Randall, Cynthia</author>+ <title>Lover Birds</title>+ <genre>Romance</genre>+ <price>4.95</price>+ <publish_date>2000-09-02</publish_date>+ <description>When Carla meets Paul at an ornithology+ conference, tempers fly as feathers get ruffled.</description>+ </book>+ <book id="bk107">+ <author>Thurman, Paula</author>+ <title>Splish Splash</title>+ <genre>Romance</genre>+ <price>4.95</price>+ <publish_date>2000-11-02</publish_date>+ <description>A deep sea diver finds true love twenty+ thousand leagues beneath the sea.</description>+ </book>+ <book id="bk108">+ <author>Knorr, Stefan</author>+ <title>Creepy Crawlies</title>+ <genre>Horror</genre>+ <price>4.95</price>+ <publish_date>2000-12-06</publish_date>+ <description>An anthology of horror stories about roaches,+ centipedes, scorpions and other insects.</description>+ </book>+ <book id="bk109">+ <author>Kress, Peter</author>+ <title>Paradox Lost</title>+ <genre>Science Fiction</genre>+ <price>6.95</price>+ <publish_date>2000-11-02</publish_date>+ <description>After an inadvertant trip through a Heisenberg+ Uncertainty Device, James Salway discovers the problems+ of being quantum.</description>+ </book>+ <book id="bk110">+ <author>O'Brien, Tim</author>+ <title>Microsoft .NET: The Programming Bible</title>+ <genre>Computer</genre>+ <price>36.95</price>+ <publish_date>2000-12-09</publish_date>+ <description>Microsoft's .NET initiative is explored in+ detail in this deep programmer's reference.</description>+ </book>+ <book id="bk111">+ <author>O'Brien, Tim</author>+ <title>MSXML3: A Comprehensive Guide</title>+ <genre>Computer</genre>+ <price>36.95</price>+ <publish_date>2000-12-01</publish_date>+ <description>The Microsoft MSXML3 parser is covered in+ detail, with attention to XML DOM interfaces, XSLT processing,+ SAX and more.</description>+ </book>+ <book id="bk112">+ <author>Galos, Mike</author>+ <title>Visual Studio 7: A Comprehensive Guide</title>+ <genre>Computer</genre>+ <price>49.95</price>+ <publish_date>2001-04-16</publish_date>+ <description>Microsoft Visual Studio 7 is explored in depth,+ looking at how Visual Basic, Visual C++, C#, and ASP+ are+ integrated into a comprehensive development+ environment.</description>+ </book>+</catalog>\ No newline at end of filediff --git a/tests/inputs/plain_html_example.txt b/tests/inputs/plain_html_example.txtnew file mode 100644index 00000000..78f814ae--- /dev/null+++ b/tests/inputs/plain_html_example.txt@@ -0,0 +1,105 @@+<body class="fixed-top-nav " style="padding-top: 57px;">+ <header>+ <nav id="navbar" class="navbar navbar-light navbar-expand-sm fixed-top">+ <div class="container">+ <a class="navbar-brand title font-weight-lighter" href="/"><span class="font-weight-bold">Marco </span>Perini</a> <button class="navbar-toggler collapsed ml-auto" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar top-bar"></span> <span class="icon-bar middle-bar"></span> <span class="icon-bar bottom-bar"></span> </button>+ <div class="collapse navbar-collapse text-right" id="navbarNav">+ <ul class="navbar-nav ml-auto flex-nowrap">+ <li class="nav-item "> <a class="nav-link" href="/">About</a> </li>+ <li class="nav-item dropdown active">+ <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Projects<span class="sr-only">(current)</span></a>+ <div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdown">+ <a class="dropdown-item" href="/projects/">Projects</a>+ <div class="dropdown-divider"></div>+ <a class="dropdown-item" href="/competitions/">Competitions</a>+ </div>+ </li>+ <li class="nav-item "> <a class="nav-link" href="/cv/">CV</a> </li>+ <li class="toggle-container"> <button id="light-toggle" title="Change theme"> <i class="fa-solid fa-moon"></i> <i class="fa-solid fa-sun"></i> </button> </li>+ </ul>+ </div>+ </div>+ </nav>+ <progress id="progress" value="0" max="284" style="top: 57px;">+ <div class="progress-container"> <span class="progress-bar"></span> </div>+ </progress>+ </header>+ <div class="container mt-5">+ <div class="post">+ <header class="post-header">+ <h1 class="post-title">Projects</h1>+ <p class="post-description"></p>+ </header>+ <article>+ <div class="projects">+ <div class="grid" style="position: relative; height: 861.992px;">+ <div class="grid-sizer"></div>+ <div class="grid-item" style="position: absolute; left: 0px; top: 0px;">+ <a href="/projects/rotary-pendulum-rl/">+ <div class="card hoverable">+ <figure>+ <picture> <img src="/assets/img/rotary_pybullet.jpg" width="auto" height="auto" alt="project thumbnail" onerror="this.onerror=null; $('.responsive-img-srcset').remove();"> </picture>+ </figure>+ <div class="card-body">+ <h4 class="card-title">Rotary Pendulum RL</h4>+ <p class="card-text">Open Source project aimed at controlling a real life rotary pendulum using RL algorithms</p>+ <div class="row ml-1 mr-1 p-0"> </div>+ </div>+ </div>+ </a>+ </div>+ <div class="grid-sizer"></div>+ <div class="grid-item" style="position: absolute; left: 260px; top: 0px;">+ <a href="https://github.com/PeriniM/DQN-SwingUp" rel="external nofollow noopener" target="_blank">+ <div class="card hoverable">+ <figure>+ <picture> <img src="/assets/img/value-policy-heatmaps.jpg" width="auto" height="auto" alt="project thumbnail" onerror="this.onerror=null; $('.responsive-img-srcset').remove();"> </picture>+ </figure>+ <div class="card-body">+ <h4 class="card-title">DQN Implementation from scratch</h4>+ <p class="card-text">Developed a Deep Q-Network algorithm to train a simple and double pendulum</p>+ <div class="row ml-1 mr-1 p-0"> </div>+ </div>+ </div>+ </a>+ </div>+ <div class="grid-sizer"></div>+ <div class="grid-item" style="position: absolute; left: 0px; top: 447.414px;">+ <a href="https://github.com/PeriniM/Multi-Agents-HAED" rel="external nofollow noopener" target="_blank">+ <div class="card hoverable">+ <figure>+ <picture> <img src="/assets/img/multi_agents_haed.gif" width="auto" height="auto" alt="project thumbnail" onerror="this.onerror=null; $('.responsive-img-srcset').remove();"> </picture>+ </figure>+ <div class="card-body">+ <h4 class="card-title">Multi Agents HAED</h4>+ <p class="card-text">University project which focuses on simulating a multi-agent system to perform environment mapping. Agents, equipped with sensors, explore and record their surroundings, considering uncertainties in their readings.</p>+ <div class="row ml-1 mr-1 p-0"> </div>+ </div>+ </div>+ </a>+ </div>+ <div class="grid-sizer"></div>+ <div class="grid-item" style="position: absolute; left: 260px; top: 370.172px;">+ <a href="/projects/wireless-esc-drone/">+ <div class="card hoverable">+ <figure>+ <picture> <img src="/assets/img/wireless_esc.gif" width="auto" height="auto" alt="project thumbnail" onerror="this.onerror=null; $('.responsive-img-srcset').remove();"> </picture>+ </figure>+ <div class="card-body">+ <h4 class="card-title">Wireless ESC for Modular Drones</h4>+ <p class="card-text">Modular drone architecture proposal and proof of concept. The project received maximum grade.</p>+ <div class="row ml-1 mr-1 p-0"> </div>+ </div>+ </div>+ </a>+ </div>+ </div>+ </div>+ </article>+ </div>+ </div>+ <footer class="fixed-bottom">+ <div class="container mt-0"> © Copyright 2023 Marco Perini. Powered by <a href="https://jekyllrb.com/" target="_blank" rel="external nofollow noopener">Jekyll</a> with <a href="https://github.com/alshedivat/al-folio" rel="external nofollow noopener" target="_blank">al-folio</a> theme. Hosted by <a href="https://pages.github.com/" target="_blank" rel="external nofollow noopener">GitHub Pages</a>. </div>+ </footer>+ <div class="hiddendiv common"></div>+</body>\ No newline at end of filediff --git a/tests/nodes/.env.example b/tests/nodes/.env.exampledeleted file mode 100644index 4c916f3e..00000000--- a/tests/nodes/.env.example+++ /dev/null@@ -1 +0,0 @@-PENAI_APIKEY="your openai.com api key"\ No newline at end of filediff --git a/tests/nodes/fetch_html_node_test.py b/tests/nodes/fetch_html_node_test.pydeleted file mode 100644index 5b7f21a5..00000000--- a/tests/nodes/fetch_html_node_test.py+++ /dev/null@@ -1,48 +0,0 @@-"""-Tests for the class FetchHTMLNode-"""-import os-import unittest-from dotenv import load_dotenv-from scrapegraphai.nodes import FetchHTMLNode--load_dotenv()-openai_key = os.getenv("OPENAI_APIKEY")---class TestFetchHTMLNode(unittest.TestCase):- """- Class for testing the class FetchHTMLNode- """-- def test_initialization(self):- """- Setup of the tests- """-- node = FetchHTMLNode("test_node")- self.assertEqual(node.node_name, "test_node")- self.assertEqual(node.node_type, "node")-- def test_execute(self):- """- Execution of the test- """- node = FetchHTMLNode("test_node")- state = {"url": "http://example.com"}- updated_state = node.execute(state)- self.assertIn("document", updated_state)- self.assertTrue(updated_state["document"])-- def test_execute_missing_url(self):- """- Test for when there are missing url- """- node = FetchHTMLNode("test_node")- state = {}- with self.assertRaises(KeyError):- node.execute(state)---if __name__ == '__main__':- unittest.main()diff --git a/tests/scrape_plain_text_ollama_test.py b/tests/scrape_plain_text_ollama_test.pynew file mode 100644index 00000000..0b37b205--- /dev/null+++ b/tests/scrape_plain_text_ollama_test.py@@ -0,0 +1,51 @@+"""+Module for the tests+"""+import os+import pytest+from scrapegraphai.graphs import SmartScraperGraph+++def sample_text():+ # Read the sample text file+ file_name = "inputs/plain_html_example.txt"+ curr_dir = os.path.dirname(os.path.realpath(__file__))+ file_path = os.path.join(curr_dir, file_name)++ with open(file_path, 'r', encoding="utf-8") as file:+ text = file.read()++ return text+++def graph_config():+ return {+ "llm": {+ "model": "ollama/mistral",+ "temperature": 0,+ "format": "json",+ "base_url": "http://localhost:11434",+ },+ "embeddings": {+ "model": "ollama/nomic-embed-text",+ "temperature": 0,+ "base_url": "http://localhost:11434",+ }+ }+++def test_scraping_pipeline(sample_text, graph_config):+ # Create the SmartScraperGraph instance+ smart_scraper_graph = SmartScraperGraph(+ prompt="List me all the news with their description.",+ source=sample_text,+ config=graph_config+ )++ # Run the graph+ result = smart_scraper_graph.run()++ # Check that the result is not empty+ assert result is not Nonediff --git a/tests/scrape_xml_ollama_test.py b/tests/scrape_xml_ollama_test.pynew file mode 100644index 00000000..343e4ecc--- /dev/null+++ b/tests/scrape_xml_ollama_test.py@@ -0,0 +1,51 @@+"""+Module for scraping XML documents+"""+import os+import pytest+from scrapegraphai.graphs import SmartScraperGraph+++def sample_xml():+ # Leggi il file XML di esempio+ file_name = "inputs/books.xml"+ curr_dir = os.path.dirname(os.path.realpath(__file__))+ file_path = os.path.join(curr_dir, file_name)++ with open(file_path, 'r', encoding="utf-8") as file:+ text = file.read()++ return text+++def graph_config():+ return {+ "llm": {+ "model": "ollama/mistral",+ "temperature": 0,+ "format": "json",+ "base_url": "http://localhost:11434",+ },+ "embeddings": {+ "model": "ollama/nomic-embed-text",+ "temperature": 0,+ "base_url": "http://localhost:11434",+ }+ }+++def test_scraping_pipeline(sample_xml, graph_config):+ # Crea un'istanza di SmartScraperGraph+ smart_scraper_graph = SmartScraperGraph(+ prompt="List me all the authors, title and genres of the books",+ source=sample_xml,+ config=graph_config+ )++ # Esegui il grafico+ result = smart_scraper_graph.run()++ # Verifica che il risultato non sia vuoto+ assert result is not Nonediff --git a/tests/smart_scraper_ollama_test.py b/tests/smart_scraper_ollama_test.pynew file mode 100644index 00000000..91c07291--- /dev/null+++ b/tests/smart_scraper_ollama_test.py@@ -0,0 +1,56 @@+"""+Module for testing th smart scraper class+"""+import pytest+from scrapegraphai.graphs import SmartScraperGraph+from scrapegraphai.utils import prettify_exec_info+++def graph_config():+ return {+ "llm": {+ "model": "ollama/mistral",+ "temperature": 0,+ "format": "json",+ "base_url": "http://localhost:11434",+ },+ "embeddings": {+ "model": "ollama/nomic-embed-text",+ "temperature": 0,+ "base_url": "http://localhost:11434",+ }+ }+++def test_scraping_pipeline(graph_config):+ # Crea un'istanza di SmartScraperGraph+ smart_scraper_graph = SmartScraperGraph(+ prompt="List me all the news with their description.",+ source="https://perinim.github.io/projects",+ config=graph_config+ )++ # Esegui il grafico+ result = smart_scraper_graph.run()++ # Verifica che il risultato non sia vuoto+ assert result is not None+++def test_get_execution_info(graph_config):+ # Crea un'istanza di SmartScraperGraph+ smart_scraper_graph = SmartScraperGraph(+ prompt="List me all the news with their description.",+ source="https://perinim.github.io/projects",+ config=graph_config+ )++ # Esegui il grafico+ smart_scraper_graph.run()++ # Ottieni le informazioni sull'esecuzione del grafico+ graph_exec_info = smart_scraper_graph.get_execution_info()++ # Verifica che le informazioni sull'esecuzione non siano vuote+ assert graph_exec_info is not Nonediff --git a/tests/utils/remover_test.py b/tests/utils/remover_test.pydeleted file mode 100644index ad08a4d5..00000000--- a/tests/utils/remover_test.py+++ /dev/null@@ -1,63 +0,0 @@-"""-Test for the remover method-"""-import unittest--from scrapegraphai.utils.remover import remover---class TestRemover(unittest.TestCase):- """Test class """-- def test_remover_basic(self):- """First test"""- html_content = """- <html>- <head>- <title>Test Page</title>- </head>- <body>- <h1>This is a Test</h1>- <p>Hello, World!</p>- <script>alert("This is a script");</script>- </body>- </html>- """- expected_result = """<title>Test Page</title>- <body><h1>This is a Test</h1><p>Hello, World!</p></body>"""- self.assertEqual(remover(html_content), expected_result)-- def test_remover_only_body(self):- """Second test"""- html_content = """- <html>- <head>- <title>Test Page</title>- </head>- <body>- <h1>This is a Test</h1>- <p>Hello, World!</p>- <script>alert("This is a script");</script>- </body>- </html>- """- expected_result = '<h1>This is a Test</h1><p>Hello, World!</p>'- self.assertEqual(- remover(html_content, only_body=True), expected_result)-- def test_remover_no_body(self):- """Third test"""- html_content = """- <html>- <head>- <title>Test Page</title>- </head>- <p>This is a paragraph.</p>- </html>- """- expected_result = '<title>Test Page</title>'- self.assertEqual(remover(html_content), expected_result)---if __name__ == '__main__':- unittest.main()diff --git a/tests/utils/result.csv b/tests/utils/result.csvdeleted file mode 100644index ab411951..00000000--- a/tests/utils/result.csv+++ /dev/null@@ -1,2 +0,0 @@-0,1,2-1,2,3diff --git a/tests/utils/result.json b/tests/utils/result.jsondeleted file mode 100644index da10bde4..00000000--- a/tests/utils/result.json+++ /dev/null@@ -1 +0,0 @@-{"trial": [1, 2, 3]}\ No newline at end of filediff --git a/tests/utils/save_audio_from_bytes_test.py b/tests/utils/save_audio_from_bytes_test.pydeleted file mode 100644index e08c2f43..00000000--- a/tests/utils/save_audio_from_bytes_test.py+++ /dev/null@@ -1,35 +0,0 @@-"""-Test file for the class save_audio_from_bytes-"""-import unittest-import os-from tempfile import TemporaryDirectory-from pathlib import Path-from scrapegraphai.utils.save_audio_from_bytes import save_audio_from_bytes---class TestSaveAudioFromBytes(unittest.TestCase):- """- Test class- """-- def test_save_audio_from_bytes(self):- """- First test- """- with TemporaryDirectory() as temp_dir:- temp_dir_path = Path(temp_dir)-- byte_response = b'\x12\x34\x56\x78\x90'-- output_path = temp_dir_path / "generated_speech.wav"-- save_audio_from_bytes(byte_response, output_path)-- self.assertTrue(output_path.exists())-- self.assertTrue(os.path.getsize(output_path) > 0)---if __name__ == "__main__":- unittest.main()diff --git a/tests/utils/test_convert_to_csv.py b/tests/utils/test_convert_to_csv.pydeleted file mode 100644index 174e9838..00000000--- a/tests/utils/test_convert_to_csv.py+++ /dev/null@@ -1,18 +0,0 @@-"""Module for testing convert_to_json inside the folder scrapegraphai/convert_to_json.py"""-import unittest-from scrapegraphai.utils.convert_to_csv import convert_to_csv---class TestConvertToCsvFunction(unittest.TestCase):- """- class for testing convert_to_json inside the folder scrapegraphai/convert_to_json.py- """-- def test_get_json(self):- """- function for testing convert_to_json inside the folder scrapegraphai/convert_to_json.py- """- example = {"trial": [1, 2, 3]}- filename = "result"- path = "../Scrapegraph-ai/tests/utils"- convert_to_csv(example, filename, path)diff --git a/tests/utils/test_convert_to_json.py b/tests/utils/test_convert_to_json.pydeleted file mode 100644index 6a269e3d..00000000--- a/tests/utils/test_convert_to_json.py+++ /dev/null@@ -1,20 +0,0 @@-"""-Module for testing convert_to_json inside the folder scrapegraphai/convert_to_json.py-"""-import unittest-from scrapegraphai.utils.convert_to_json import convert_to_json---class TestConvertToJSonFunction(unittest.TestCase):- """- class for testing convert_to_json inside the folder scrapegraphai/convert_to_json.py- """-- def test_get_json(self):- """- function for testing convert_to_json inside the folder scrapegraphai/convert_to_json.py- """- example = {"trial": [1, 2, 3]}- filename = "result"- path = "../Scrapegraph-ai/test/utils"- convert_to_json(example, filename, path)diff --git a/tests/utils/token_calculator_test.py b/tests/utils/token_calculator_test.pydeleted file mode 100644index 708dcca4..00000000--- a/tests/utils/token_calculator_test.py+++ /dev/null@@ -1,32 +0,0 @@-"""-Test fo testing the tokenizer-"""-import unittest-from scrapegraphai.utils.token_calculator import truncate_text_tokens---class TestTruncateTextTokens(unittest.TestCase):- """- Class for testing the tokenizer- """-- def test_truncate_text_tokens(self):- """- Principal text- """- input_text = "This is a sample text to be tokenized into chunks."- expected_output = [- "This is a sample text to be tokenized into",- "chunks."- ]- model_name = "gpt-3.5-turbo"- encoding_name = "EMBEDDING_ENCODING"-- output_chunks = truncate_text_tokens(- input_text, model_name, encoding_name)-- self.assertEqual(output_chunks, expected_output)---if __name__ == '__main__':- unittest.main()