Annotate products that could not be found by scrapers

This commit is contained in:
polyfloyd 2025-04-21 11:29:27 +02:00
parent d69f35cfcc
commit 650aef9794
3 changed files with 32 additions and 3 deletions

View file

@ -1,4 +1,5 @@
from scrapers import ah_get_by_gtin, sligro_get_by_gtin, parse_content_description, Product
from scrapers import ah_get_by_gtin, sligro_get_by_gtin, parse_content_description, Product, ProductNotFoundError
import pytest
def test_scrape_ah():
@ -11,6 +12,11 @@ def test_scrape_ah():
assert prod.aliases == []
def test_scrape_ah_not_found():
with pytest.raises(ProductNotFoundError):
ah_get_by_gtin('9999999999999')
def test_scrape_sligro():
# Cola zero sugar
prod = sligro_get_by_gtin('5000112659184')
@ -21,6 +27,11 @@ def test_scrape_sligro():
assert prod.aliases == ['5000112658873']
def test_scrape_sligro_not_found():
with pytest.raises(ProductNotFoundError):
sligro_get_by_gtin('9999999999999')
def test_parse_content_description():
assert parse_content_description('40 stuks x 22,5 gram') == (40, '22,5 gram')
assert parse_content_description('4 multipacks x 6 blikjes x 33 cl') == (24, '33 cl')