mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-11-05 08:51:20 +00:00
* bump * Initial function write * Delete this line from yaml * Changed all the main things - Need help on tests * pylint errors * Tests v0 * Tests v1 * Tests v2 --------- Co-authored-by: andrewkenreich <andrew.kenreich@gmail.com>
39 lines
943 B
Python
39 lines
943 B
Python
# IMPORTATION STANDARD
|
|
from datetime import datetime
|
|
|
|
# IMPORTATION THIRDPARTY
|
|
import pytest
|
|
import requests
|
|
|
|
# IMPORTATION INTERNAL
|
|
from openbb_terminal.stocks.options import alphaquery_model
|
|
|
|
|
|
@pytest.mark.vcr
|
|
def test_get_put_call_ratio(recorder):
|
|
result_df = alphaquery_model.get_put_call_ratio(
|
|
symbol="PM",
|
|
window=10,
|
|
start_date=datetime.strptime("2021-12-01", "%Y-%m-%d"),
|
|
)
|
|
|
|
recorder.capture(result_df)
|
|
|
|
|
|
@pytest.mark.vcr(record_mode="none")
|
|
def test_get_put_call_ratio_invalid_status(mocker):
|
|
mock_response = requests.Response()
|
|
mock_response.status_code = 400
|
|
mocker.patch(
|
|
target="openbb_terminal.helper_funcs.requests.get",
|
|
new=mocker.Mock(return_value=mock_response),
|
|
)
|
|
|
|
result_df = alphaquery_model.get_put_call_ratio(
|
|
symbol="PM",
|
|
window=10,
|
|
start_date=datetime.strptime("2021-12-01", "%Y-%m-%d"),
|
|
)
|
|
|
|
assert result_df.empty
|