mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-27 12:40:35 +00:00
* PyDocstyle Compliant batch 1 * Batch 2 * Batch 3 * Batch 4 * Batch 5 * Batch 6 * Batch 7 * Linting * MyPy * mypy things * black * more mypy * black * fix that * black again * undo that * Fix error message * pylint --------- Co-authored-by: montezdesousa <79287829+montezdesousa@users.noreply.github.com> Co-authored-by: Danglewood <85772166+deeleeramone@users.noreply.github.com>
52 lines
1.3 KiB
Python
52 lines
1.3 KiB
Python
"""Test Commodity extension."""
|
|
|
|
import pytest
|
|
from openbb_core.app.model.obbject import OBBject
|
|
|
|
# pylint: disable=redefined-outer-name
|
|
|
|
|
|
@pytest.fixture(scope="session")
|
|
def obb(pytestconfig): # pylint: disable=inconsistent-return-statements
|
|
"""Fixture to setup obb."""
|
|
if pytestconfig.getoption("markexpr") != "not integration":
|
|
import openbb # pylint: disable=import-outside-toplevel
|
|
|
|
return openbb.obb
|
|
|
|
|
|
@pytest.mark.parametrize(
|
|
"params",
|
|
[
|
|
(
|
|
{
|
|
"asset": "gold",
|
|
"start_date": None,
|
|
"end_date": None,
|
|
"collapse": None,
|
|
"transform": None,
|
|
"provider": "nasdaq",
|
|
}
|
|
),
|
|
(
|
|
{
|
|
"asset": "silver",
|
|
"start_date": "1990-01-01",
|
|
"end_date": "2023-01-01",
|
|
"collapse": "monthly",
|
|
"transform": "diff",
|
|
"provider": "nasdaq",
|
|
}
|
|
),
|
|
],
|
|
)
|
|
@pytest.mark.integration
|
|
def test_commodity_lbma_fixing(params, obb):
|
|
"""Test the LBMA fixing endpoint."""
|
|
params = {p: v for p, v in params.items() if v}
|
|
|
|
result = obb.commodity.lbma_fixing(**params)
|
|
assert result
|
|
assert isinstance(result, OBBject)
|
|
assert len(result.results) > 0
|