mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-30 05:52:23 +00:00
* Fix the formatting test by changing futures input to symbol not ticker * Regenerate sdk docs * Add test for economy macro * fred query test * Futures * FRED Test * lint * flake fix * black fix * futures again * Test Index * Add treasury tests * pylint ignore too many lines * FOrgot end date
78 lines
1.6 KiB
Python
78 lines
1.6 KiB
Python
# IMPORTATION STANDARD
|
|
|
|
# IMPORTATION THIRDPARTY
|
|
import pytest
|
|
import yfinance
|
|
|
|
# IMPORTATION INTERNAL
|
|
from openbb_terminal.futures import yfinance_view
|
|
|
|
|
|
@pytest.fixture(scope="module")
|
|
def vcr_config():
|
|
return {
|
|
"filter_headers": [("User-Agent", None)],
|
|
"filter_query_parameters": [
|
|
("period1", "MOCK_PERIOD_1"),
|
|
("period2", "MOCK_PERIOD_2"),
|
|
],
|
|
}
|
|
|
|
|
|
@pytest.mark.vcr()
|
|
@pytest.mark.record_stdout
|
|
@pytest.mark.parametrize(
|
|
"category",
|
|
["agriculture", "metals"],
|
|
)
|
|
def test_display_search(category):
|
|
yfinance_view.display_search(
|
|
category=category, exchange="", description="", export=""
|
|
)
|
|
|
|
|
|
@pytest.mark.vcr
|
|
@pytest.mark.record_stdout
|
|
@pytest.mark.parametrize(
|
|
"symbols",
|
|
[
|
|
["BLK", "SB"],
|
|
["ES", "SF"],
|
|
],
|
|
)
|
|
def test_display_historical(mocker, symbols):
|
|
yf_download = yfinance.download
|
|
|
|
def mock_yf_download(*args, **kwargs):
|
|
kwargs["threads"] = False
|
|
return yf_download(*args, **kwargs)
|
|
|
|
mocker.patch("yfinance.download", side_effect=mock_yf_download)
|
|
|
|
yfinance_view.display_historical(
|
|
symbols=symbols,
|
|
start_date="2022-10-10",
|
|
raw=True,
|
|
)
|
|
|
|
|
|
@pytest.mark.vcr
|
|
@pytest.mark.record_stdout
|
|
@pytest.mark.parametrize(
|
|
"symbol",
|
|
["ES", "YI"],
|
|
)
|
|
def test_display_curve(mocker, symbol):
|
|
yf_download = yfinance.download
|
|
|
|
def mock_yf_download(*args, **kwargs):
|
|
kwargs["threads"] = False
|
|
return yf_download(*args, **kwargs)
|
|
|
|
mocker.patch("yfinance.download", side_effect=mock_yf_download)
|
|
|
|
yfinance_view.display_curve(
|
|
symbol=symbol,
|
|
raw=True,
|
|
)
|