def setup_class(self): self.share = Stock("AAPL") self.share2 = Stock("AAPL", output_format='pandas') self.share4 = Stock("AAPL", json_parse_int=Decimal, json_parse_float=Decimal) self.share5 = Stock("TSLA")
def setup_class(self): self.cshare = Stock("aapl") self.cshare2 = Stock("aapl", output_format='pandas') self.cshare3 = Stock("svxy") self.cshare4 = Stock("aapl", json_parse_int=Decimal, json_parse_float=Decimal) self.cshare5 = Stock("gig^")
def test_wrong_iex_input_type(self): with pytest.raises(ValueError): Stock(34) with pytest.raises(ValueError): Stock("") with pytest.raises(ValueError): ls = [] Stock(ls)
def setup_class(self): self.batch = Stock(["AAPL", "TSLA"]) self.batch2 = Stock(["AAPL", "TSLA"], output_format='pandas') self.batch4 = Stock(["AAPL", "TSLA"], json_parse_int=Decimal, json_parse_float=Decimal)
def test_invalid_symbol(self): data = Stock("BAD SYMBOL") with pytest.raises(IEXSymbolError): data.get_price()
def test_invalid_symbol_or_symbols(self): with pytest.raises(IEXSymbolError): a = Stock(["TSLA", "BAD SYMBOL", "BAD SYMBOL"]) a.get_price()
def setup_class(self): self.cbatch = Stock(["aapl", "tsla"]) self.cbatch2 = Stock(["aapl", "tsla"], output_format='pandas') self.cbatch3 = Stock(["uvxy", "svxy"])
def test_symbol_list_too_long(self): with pytest.raises(ValueError): x = ["tsla"] * 102 Stock(x)
def test_listed_crypto_symbols(self): a = Stock(self.ticks) assert isinstance(a.get_quote(), dict)