googlefinance/tests/test_googlefinance.py

18 lines
577 B
Python
Raw Normal View History

2015-04-16 15:59:26 -05:00
import googlefinance
import unittest
class TestQuotes(unittest.TestCase):
def test_one_symbol(self):
appl = googlefinance.getQuotes('GOOG')[0]
self.assertEqual(appl["Index"], "NASDAQ")
self.assertEqual(appl["StockSymbol"], "GOOG")
def test_symbols(self):
quotes = googlefinance.getQuotes(['GOOG', 'VIE:BKS'])
self.assertEqual(quotes[0]["Index"], "NASDAQ")
self.assertEqual(quotes[0]["StockSymbol"], "GOOG")
self.assertEqual(quotes[1]["Index"], "VIE")
self.assertEqual(quotes[1]["StockSymbol"], "BKS")