1
0
fin-defs/test/test_data.py

22 lines
503 B
Python
Raw Normal View History

2024-05-27 21:03:16 +00:00
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):
2024-09-01 15:39:04 +00:00
with pytest.raises(Exception) as e:
2024-05-27 21:03:16 +00:00
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'