Skip to content

Commit

Permalink
Add more merge test cases
Browse files Browse the repository at this point in the history
These were supposed to fail, but unfortunately didn't, so the bug is not
as simple as the test cases try to check. However, I'll still leave them
in since they're worth having. The bug described in #2 is probably
elsewhere.
  • Loading branch information
Javex committed Oct 3, 2023
1 parent b6f0421 commit b68d059
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion tests/test_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,22 @@ def test_merge_price_history():
assert item['price'] == 2
assert len(item['priceHistory']) == 2
assert item['priceHistory'][0]['price'] == 2
assert item['priceHistory'][1]['price'] == 3
assert item['priceHistory'][1]['price'] == 3

# Repeat run of history on same day
old_items = [get_item()]
new_items = [old_items[0]]
items = analysis.merge_price_history(old_items, new_items)
assert len(items) == 1
item = items[0]
assert len(item['priceHistory']) == 1

# Prices with history don't get overwritten
oldest_items = [get_item()]
middle_items = [get_item(price=2)]
newest_items = [get_item(price=2)]
items = analysis.merge_price_history(oldest_items, middle_items)
items = analysis.merge_price_history(items, newest_items)
assert len(items) == 1
item = items[0]
assert len(item['priceHistory']) == 2

0 comments on commit b68d059

Please sign in to comment.