Skip to content

Commit

Permalink
Improve error message in plot_stock_market.py
Browse files Browse the repository at this point in the history
  • Loading branch information
lesteve authored and Joan Massich committed Sep 15, 2017
1 parent 3c28228 commit c62f6f0
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions examples/applications/plot_stock_market.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,16 @@ def quotes_historical_google(symbol, date1, date2):
min_date = data['date'].min()
max_date = data['date'].max()
if (len_data != expected_len_data or min_date != d1 or max_date != d2):
raise ValueError('min_date, max_date, len(data) should be {}, {}, {} '
'Got {}, {}, {} instead.'.format(
d1, d2, expected_len_data,
min_date, max_date, len_data))
message = (
'Got wrong data for symbol {}, url {}\n'
' - min_date should be {}, got {}\n'
' - max_date should be {}, got {}\n'
' - len(data) should be {}, got {}'.format(
symbol, url,
d1.date(), min_date.date(),
d2.date(), max_date.date(),
expected_len_data, len_data))
raise ValueError(message)
return data

# #############################################################################
Expand Down

0 comments on commit c62f6f0

Please sign in to comment.