Skip to content

Commit

Permalink
Merge branch 'main' into ci-autobuild
Browse files Browse the repository at this point in the history
  • Loading branch information
gmasse committed Sep 27, 2023
2 parents a923dba + 5449761 commit 3be08d4
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions tests/test_yf_stock_ticker.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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


Expand All @@ -78,4 +72,3 @@ def test_gen_drodpdown(capsys):
--Open: 174.67 | font='Menlo'
--Day's Range: 174.06 - 177.08 | font='Menlo'
"""

0 comments on commit 3be08d4

Please sign in to comment.