mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-30 05:52:23 +00:00
* fix command runner tests that were generating logs * use the import behind a fixture * updating the generator
181 lines
4.2 KiB
Python
181 lines
4.2 KiB
Python
"""Test fixedincome extension."""
|
|
import pytest
|
|
from openbb_core.app.model.obbject import OBBject
|
|
|
|
|
|
@pytest.fixture(scope="session")
|
|
def obb(pytestconfig):
|
|
"""Fixture to setup obb."""
|
|
|
|
if pytestconfig.getoption("markexpr") != "not integration":
|
|
import openbb
|
|
|
|
return openbb.obb
|
|
|
|
|
|
@pytest.mark.parametrize(
|
|
"params",
|
|
[
|
|
({"start_date": "2023-01-01", "end_date": "2023-06-06"}),
|
|
],
|
|
)
|
|
@pytest.mark.integration
|
|
def test_fixedincome_treasury(params, obb):
|
|
result = obb.fixedincome.treasury(**params)
|
|
assert result
|
|
assert isinstance(result, OBBject)
|
|
assert len(result.results) > 0
|
|
|
|
|
|
@pytest.mark.parametrize(
|
|
"params",
|
|
[
|
|
({"date": "2023-01-01", "inflation_adjusted": True}),
|
|
],
|
|
)
|
|
@pytest.mark.integration
|
|
def test_fixedincome_ycrv(params, obb):
|
|
result = obb.fixedincome.ycrv(**params)
|
|
assert result
|
|
assert isinstance(result, OBBject)
|
|
assert len(result.results) > 0
|
|
|
|
|
|
@pytest.mark.parametrize(
|
|
"params",
|
|
[
|
|
({"start_date": "2023-01-01", "end_date": "2023-06-06"}),
|
|
(
|
|
{
|
|
"period": "overnight",
|
|
"provider": "fred",
|
|
"start_date": "2023-01-01",
|
|
"end_date": "2023-06-06",
|
|
}
|
|
),
|
|
],
|
|
)
|
|
@pytest.mark.integration
|
|
def test_fixedincome_sofr(params, obb):
|
|
result = obb.fixedincome.sofr(**params)
|
|
assert result
|
|
assert isinstance(result, OBBject)
|
|
assert len(result.results) > 0
|
|
|
|
|
|
@pytest.mark.parametrize(
|
|
"params",
|
|
[
|
|
({"start_date": "2023-01-01", "end_date": "2023-06-06"}),
|
|
(
|
|
{
|
|
"parameter": "volume_weighted_trimmed_mean_rate",
|
|
"provider": "fred",
|
|
"start_date": "2023-01-01",
|
|
"end_date": "2023-06-06",
|
|
}
|
|
),
|
|
],
|
|
)
|
|
@pytest.mark.integration
|
|
def test_fixedincome_estr(params, obb):
|
|
result = obb.fixedincome.estr(**params)
|
|
assert result
|
|
assert isinstance(result, OBBject)
|
|
assert len(result.results) > 0
|
|
|
|
|
|
@pytest.mark.parametrize(
|
|
"params",
|
|
[
|
|
({"start_date": "2023-01-01", "end_date": "2023-06-06"}),
|
|
(
|
|
{
|
|
"parameter": "rate",
|
|
"provider": "fred",
|
|
"start_date": "2023-01-01",
|
|
"end_date": "2023-06-06",
|
|
}
|
|
),
|
|
],
|
|
)
|
|
@pytest.mark.integration
|
|
def test_fixedincome_sonia(params, obb):
|
|
result = obb.fixedincome.sonia(**params)
|
|
assert result
|
|
assert isinstance(result, OBBject)
|
|
assert len(result.results) > 0
|
|
|
|
|
|
@pytest.mark.parametrize(
|
|
"params",
|
|
[
|
|
({"start_date": "2023-01-01", "end_date": "2023-06-06"}),
|
|
(
|
|
{
|
|
"parameter": "overnight",
|
|
"provider": "fred",
|
|
"start_date": "2023-01-01",
|
|
"end_date": "2023-06-06",
|
|
}
|
|
),
|
|
],
|
|
)
|
|
@pytest.mark.integration
|
|
def test_fixedincome_ameribor(params, obb):
|
|
result = obb.fixedincome.ameribor(**params)
|
|
assert result
|
|
assert isinstance(result, OBBject)
|
|
assert len(result.results) > 0
|
|
|
|
|
|
@pytest.mark.parametrize(
|
|
"params",
|
|
[
|
|
({"start_date": "2023-01-01", "end_date": "2023-06-06"}),
|
|
(
|
|
{
|
|
"parameter": "weekly",
|
|
"provider": "fred",
|
|
"start_date": "2023-01-01",
|
|
"end_date": "2023-06-06",
|
|
}
|
|
),
|
|
],
|
|
)
|
|
@pytest.mark.integration
|
|
def test_fixedincome_fed(params, obb):
|
|
result = obb.fixedincome.fed(**params)
|
|
assert result
|
|
assert isinstance(result, OBBject)
|
|
assert len(result.results) > 0
|
|
|
|
|
|
@pytest.mark.parametrize(
|
|
"params",
|
|
[
|
|
({}),
|
|
({"long_run": True, "provider": "fred"}),
|
|
],
|
|
)
|
|
@pytest.mark.integration
|
|
def test_fixedincome_projections(params, obb):
|
|
result = obb.fixedincome.projections(**params)
|
|
assert result
|
|
assert isinstance(result, OBBject)
|
|
assert len(result.results) > 0
|
|
|
|
|
|
@pytest.mark.parametrize(
|
|
"params",
|
|
[
|
|
({"start_date": "2023-01-01", "end_date": "2023-06-06"}),
|
|
],
|
|
)
|
|
@pytest.mark.integration
|
|
def test_fixedincome_iorb(params, obb):
|
|
result = obb.fixedincome.iorb(**params)
|
|
assert result
|
|
assert isinstance(result, OBBject)
|
|
assert len(result.results) > 0
|