import pytest import fin_defs BAD_TICKERS = ['TEST123', '123', 'TEST.EUR', 'TEST:EUR', 'EUR:TEST'] @pytest.mark.parametrize('ticker', BAD_TICKERS) def test_bad_tickers(ticker): with pytest.raises(Exception) as e: fin_defs.Stock(ticker) @pytest.mark.parametrize('ticker', BAD_TICKERS) def test_crypto_tickers(ticker): fin_defs.CryptoCurrency(ticker, 'not-known') def test_str(): NVO = fin_defs.Stock('NVO', fin_defs.EXCHANGES_BY_IDS['NYSE']) assert str(NVO) == 'NVO.XNYS'