def test_empty(self): o = PriceDict('') self.assertEqual(o.data(), {})
def test_same_share_repeated(self): o = PriceDict(DATA_SAME_SHARE_REPEATED) self.assertEqual(o.data(), {'AAL.L': ['1484.0', 'GBp'] })
def test_mixed_query(self): o = PriceDict(DATA_MIXED) self.assertEqual(o.data(), {'AAL.L': ['1484.0', 'GBp'], 'GBPUSD=X': ['1.315824', 'USD'], })
def test_one_index(self): o = PriceDict(DATA_ONE_INDEX) #NOTE: key is ^FTSE self.assertEqual(o.data(), { '^FTSE': ['7492.57', 'GBP'] })
def test_one_fx(self): o = PriceDict(DATA_ONE_FX) #NOTE: key is GBPEUR=X self.assertEqual(o.data(), { 'GBPEUR=X': ['1.1277249', 'EUR'] })
def test_two_shares(self): o = PriceDict(DATA_TWO_SHARES) self.assertEqual(o.data(), { 'BARC.L': ['178.95', 'GBp'], 'VOD.L': ['220.95', 'GBp'], })
def test_one_share(self): o = PriceDict(DATA_ONE_SHARE) self.assertEqual(o.data(), { 'GSK.L': ['1351.0', 'GBp'] })
def test_known_symbol_wrong_exchange(self): o = PriceDict(DATA_KNOWN_SYMBOL_WRONG_EXCHANGE) self.assertEqual(o.data(), {'AAT.L': ['', '']} )
def test_unknown_symbol(self): o = PriceDict(DATA_UNKNOWN_SYMBOL) self.assertEqual(o.data(), {})
def test_empty_symbol(self): o = PriceDict(DATA_EMPTY_SYMBOL) self.assertEqual(o.data(), {})