Skip to content

Commit 0107855

Browse files
committed
Upate csv test
1 parent de370de commit 0107855

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

amazonscraper/client.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,8 @@ def _get_prices(self, product):
261261
"""
262262
Given the HTML of a `product`, extract all prices.
263263
"""
264+
# XXX currently does not handle shipping prices or prices for the
265+
# various formats of books.
264266

265267
# match all prices of the form $X,XXX.XX:
266268
raw_prices = product.find_all(text=re.compile('\$[\d,]+.\d\d'))

test/test_amazonscraper.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,5 +77,7 @@ def test_amazonscraper_csv_header():
7777
products = amazonscraper.search(
7878
keywords="Python",
7979
max_product_nb=1)
80-
assert "Product title,Rating,Number of customer reviews,Product URL,\
81-
Image URL,ASIN\n" in str(products.csv())
80+
products.csv('test.csv')
81+
with open('test.csv') as f:
82+
csv_str = f.read()
83+
assert "title,rating,review_nb,img,url,asin,prices_per_unit,units,prices_main" in csv_str

0 commit comments

Comments
 (0)