From 544976176a1093f172e7d8b47809e92b1fdbf9c1 Mon Sep 17 00:00:00 2001 From: Germain Masse Date: Wed, 27 Sep 2023 18:21:30 -0400 Subject: [PATCH] ci: fix test (yahooquery monkeypatch update) --- tests/test_yf_stock_ticker.py | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/tests/test_yf_stock_ticker.py b/tests/test_yf_stock_ticker.py index b21a990..4ce1743 100644 --- a/tests/test_yf_stock_ticker.py +++ b/tests/test_yf_stock_ticker.py @@ -1,6 +1,6 @@ import os import sys -import yahooquery +from yahooquery import Ticker import yf_stock_ticker.yf_stock_ticker as yf_stock_ticker os.environ['TZ'] = 'UTC' # set default timezone @@ -49,20 +49,14 @@ 'volume24Hr': {}, 'volumeAllCurrencies': {}}} -class MockTicker: - @property - def price(self): + +def test_get_quotes(monkeypatch): + def mock_quote_summary(*args, **kwargs): output = sample_quote_data output['UNKNOW'] = 'Quote not found for ticker symbol: UNKNOWN' return output; - - -def test_get_quotes(monkeypatch): - def mock_ticker(*args, **kwargs): - return MockTicker() - - monkeypatch.setattr(yahooquery, "Ticker", MockTicker) + monkeypatch.setattr(Ticker, "_quote_summary", mock_quote_summary) assert yf_stock_ticker.get_quotes(['AAPL']) == sample_quote_data @@ -78,4 +72,3 @@ def test_gen_drodpdown(capsys): --Open: 174.67 | font='Menlo' --Day's Range: 174.06 - 177.08 | font='Menlo' """ -