chore: sync project files
This commit is contained in:
39
test_cdiscount_parser.py
Executable file
39
test_cdiscount_parser.py
Executable file
@@ -0,0 +1,39 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Test rapide du parser Cdiscount avec la fixture."""
|
||||
|
||||
from pricewatch.app.stores.cdiscount.store import CdiscountStore
|
||||
|
||||
# Charger la fixture
|
||||
with open("pricewatch/app/stores/cdiscount/fixtures/cdiscount_tuf608umrv004_pw.html", "r", encoding="utf-8") as f:
|
||||
html = f.read()
|
||||
|
||||
url = "https://www.cdiscount.com/informatique/ordinateurs-pc-portables/pc-portable-gamer-asus-tuf-gaming-a16-sans-windo/f-10709-tuf608umrv004.html"
|
||||
|
||||
store = CdiscountStore()
|
||||
snapshot = store.parse(html, url)
|
||||
|
||||
print("=" * 80)
|
||||
print("TEST PARSER CDISCOUNT")
|
||||
print("=" * 80)
|
||||
|
||||
print(f"\nSource: {snapshot.source}")
|
||||
print(f"URL: {snapshot.url}")
|
||||
print(f"Reference: {snapshot.reference}")
|
||||
print(f"Title: {snapshot.title[:80] if snapshot.title else None}")
|
||||
print(f"Price: {snapshot.price} {snapshot.currency}")
|
||||
print(f"Stock: {snapshot.stock_status}")
|
||||
print(f"Images: {len(snapshot.images)} images")
|
||||
for i, img in enumerate(snapshot.images[:3]):
|
||||
print(f" [{i+1}] {img[:80]}")
|
||||
print(f"Category: {snapshot.category}")
|
||||
print(f"Specs: {len(snapshot.specs)} specs")
|
||||
for key, value in list(snapshot.specs.items())[:5]:
|
||||
print(f" - {key}: {value}")
|
||||
|
||||
print(f"\nDebug status: {snapshot.debug.status}")
|
||||
print(f"Debug errors: {len(snapshot.debug.errors)}")
|
||||
for err in snapshot.debug.errors:
|
||||
print(f" - {err}")
|
||||
|
||||
print(f"\nIs complete: {snapshot.is_complete()}")
|
||||
print("=" * 80)
|
||||
Reference in New Issue
Block a user