Merge branch 'dev' into test/normalize-credentials-coverage

This commit is contained in:
Karim shoair
2026-03-15 16:24:59 +02:00
committed by GitHub
64 changed files with 5330 additions and 362 deletions
-17
View File
@@ -7,7 +7,6 @@ from scrapling.engines.toolbelt.navigation import (
create_async_intercept_handler,
)
from scrapling.engines.toolbelt.fingerprints import (
generate_convincing_referer,
get_os_name,
generate_headers
)
@@ -204,22 +203,6 @@ class TestConstructProxyDict:
class TestFingerprintFunctions:
"""Test fingerprint generation functions"""
def test_generate_convincing_referer(self):
"""Test referer generation"""
url = "https://sub.example.com/page.html"
result = generate_convincing_referer(url)
assert result.startswith("https://www.google.com/search?q=")
assert "example" in result
def test_generate_convincing_referer_caching(self):
"""Test referer generation caching"""
url = "https://example.com"
result1 = generate_convincing_referer(url)
result2 = generate_convincing_referer(url)
assert result1 == result2
def test_get_os_name(self):
"""Test OS name detection"""
result = get_os_name()
+27
View File
@@ -183,6 +183,33 @@ class TestAdvancedSelectors:
text = page.get_all_text(valid_values=False)
assert text != ""
def test_get_all_text_preserves_interleaved_text_nodes(self):
"""Test get_all_text preserves interleaved text nodes"""
html = """
<html>
<body>
<main>
string1
<b>string2</b>
string3
<div>
<span>string4</span>
</div>
string5
<script>ignored</script>
string6
<style>ignored</style>
string7
</main>
</body>
</html>
"""
page = Selector(html, adaptive=False)
node = page.css("main")[0]
assert node.get_all_text("\n", strip=True) == "string1\nstring2\nstring3\nstring4\nstring5\nstring6\nstring7"
class TestTextHandlerAdvanced:
"""Test advanced TextHandler functionality"""
+1 -1
View File
@@ -1,6 +1,6 @@
pytest>=2.8.0,<9
pytest-cov
playwright==1.56.0
playwright==1.58.0
werkzeug<3.0.0
pytest-httpbin==2.1.0
pytest-asyncio