24 lines
516 B
Python
24 lines
516 B
Python
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):
|
|
try:
|
|
fin_defs.Stock(ticker)
|
|
except Exception as e:
|
|
assert e
|
|
|
|
|
|
@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'
|