Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unit test to demonstate broken alignment in get_all #22

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions test_ystockquote.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,39 @@ def test_get_historical_prices(self):
self.assertGreater(float(prices[end_date]['Volume']), 0.0)
self.assertGreater(float(prices[end_date]['Adj Close']), 0.0)

def test_get_all_alignment(self):
""" Compare bulk 'all_info' values to individual values.
Currently broken due to misalignment from invalid CSV in
fields: f6, k3, and maybe j2, a5, b6.
"""
symbol = 'GOOG'
all_info = ystockquote.get_all(symbol)
self.assertIsInstance(all_info, dict)
self.assertEquals(
all_info['previous_close'],
ystockquote.get_previous_close(symbol))
self.assertEquals(
all_info['volume'],
ystockquote.get_volume(symbol))
self.assertEquals(
all_info['bid_realtime'],
ystockquote.get_bid_realtime(symbol))
self.assertEquals(
all_info['ask_realtime'],
ystockquote.get_ask_realtime(symbol))
self.assertEquals(
all_info['last_trade_price'],
ystockquote.get_last_trade_price(symbol))
self.assertEquals(
all_info['today_open'],
ystockquote.get_today_open(symbol))
self.assertEquals(
all_info['todays_high'],
ystockquote.get_todays_high(symbol))
self.assertEquals(
all_info['last_trade_date'],
ystockquote.get_last_trade_date(symbol))


if __name__ == '__main__':
unittest.main()