remove smoke_tests/test_render_scraper_script.py
This commit is contained in:
@@ -1,39 +0,0 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import importlib.util
|
||||
import re
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def test_render_scraper_script_has_no_numeric_underscore_literals() -> None:
|
||||
agent_path = Path(__file__).resolve().parents[1] / "agent.py"
|
||||
spec = importlib.util.spec_from_file_location("agent", agent_path)
|
||||
assert spec is not None and spec.loader is not None
|
||||
module = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(module)
|
||||
|
||||
script = module._render_scraper_script(
|
||||
{
|
||||
"url": "https://example.com/",
|
||||
"selectors": {"title": "title"},
|
||||
"max_pages": 1,
|
||||
"wait_seconds": 0,
|
||||
"output_format": "json",
|
||||
"headless": True,
|
||||
"user_agent": "SmokeTest",
|
||||
"respect_robots": True,
|
||||
"rate_limit_seconds": 0,
|
||||
"screenshot": False,
|
||||
"output_dir": "/workspace/outputs/seleniumbase-website-scraper",
|
||||
}
|
||||
)
|
||||
|
||||
numeric_underscore_literal = re.compile(r"(?<![A-Za-z0-9_])\d+(?:_\d+)+(?![A-Za-z0-9_])")
|
||||
assert numeric_underscore_literal.findall(script) == []
|
||||
assert "response.read(2000000)" in script
|
||||
assert "response.read(2_000_000)" not in script
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
test_render_scraper_script_has_no_numeric_underscore_literals()
|
||||
print("smoke ok: no numeric underscore literals; response.read(2000000) present")
|
||||
Reference in New Issue
Block a user