🕷️ The BEST Web Scraping framework that handles everything from a single request to a full-scale crawl! Don't be shy, join here: https://discord.gg/EMgGbDceNQ and follow here for daily tips and tricks: https://x.com/Scrapling_dev
Python aiai-scrapingautomationcrawlercrawlingcrawling-pythondatadata-extractionmcpmcp-serverplaywrightpythonscrapingselectorsstealthweb-scraperweb-scrapingweb-scraping-pythonwebscrapingxpath
test: update the tests accordingly
Karim shoair9acc8194c52b
diff --git a/tests/cli/test_cli.py b/tests/cli/test_cli.pyindex e2f86f3..39345d0 100644--- a/tests/cli/test_cli.py+++ b/tests/cli/test_cli.py@@ -17,7 +17,6 @@ def configure_selector_mock():mock_response.html_content = "<html><body>Test content</body></html>"mock_response.encoding = "utf-8"mock_response.get_all_text.return_value = "Test content"- mock_response.css_first.return_value = mock_responsemock_response.css.return_value = [mock_response]return mock_responsediff --git a/tests/parser/test_general.py b/tests/parser/test_general.pyindex e5f8d59..808b65d 100644--- a/tests/parser/test_general.py+++ b/tests/parser/test_general.py@@ -147,7 +147,7 @@ class TestTextMatching:class TestSimilarElements:def test_finding_similar_products(self, page):"""Test finding similar product elements"""- first_product = page.css_first(".product")+ first_product = page.css(".product").firstsimilar_products = first_product.find_similar()assert len(similar_products) == 2@@ -255,7 +255,7 @@ class TestElementNavigation:class TestJSONAndAttributes:def test_json_conversion(self, page):"""Test converting content to JSON"""- script_content = page.css("#page-data::text")[0]+ script_content = page.css("#page-data::text")[0].get()assert issubclass(type(script_content.sort()), str)page_data = script_content.json()assert page_data["totalProducts"] == 3@@ -282,7 +282,7 @@ class TestJSONAndAttributes:assert list(key_value[0].keys()) == ["data-id"]# JSON attribute conversion- attr_json = page.css_first("#products").attrib["schema"].json()+ attr_json = page.css("#products").first.attrib["schema"].json()assert attr_json == {"jsonable": "data"}assert isinstance(page.css("#products")[0].attrib.json_string, bytes)diff --git a/tests/parser/test_parser_advanced.py b/tests/parser/test_parser_advanced.pyindex 3ac81cf..57086ba 100644--- a/tests/parser/test_parser_advanced.py+++ b/tests/parser/test_parser_advanced.py@@ -121,11 +121,12 @@ class TestAdvancedSelectors:# ::text pseudo-elementtexts = page.css("p::text")assert len(texts) == 2- assert isinstance(texts[0], TextHandler)+ assert isinstance(texts[0], Selector)+ assert isinstance(texts[0].get(), TextHandler)# ::attr() pseudo-elementattrs = page.css("div::attr(class)")- assert "container" in attrs+ assert "container" in attrs.getall()def test_complex_attribute_operations(self, complex_html):"""Test complex attribute handling"""