Download openbb_platform/extensions/index/integration/test_index_python.py from CatPtain/OpenBB: direct link, hf CLI and curl.
- Browser
- Download file 5.28 kB
-
https://huggingface.co/spaces/CatPtain/OpenBB/resolve/main/openbb_platform/extensions/index/integration/test_index_python.py
- Command line
-
hf download hf://spaces/CatPtain/OpenBB/openbb_platform/extensions/index/integration/test_index_python.py
-
curl -L -o test_index_python.py https://huggingface.co/spaces/CatPtain/OpenBB/resolve/main/openbb_platform/extensions/index/integration/test_index_python.py
5.28 kB
| """Test economy extension.""" | |
| import pytest | |
| from extensions.tests.conftest import parametrize | |
| from openbb_core.app.model.obbject import OBBject | |
| 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 | |
| # pylint: disable=redefined-outer-name | |
| def test_index_constituents(params, obb): | |
| """Test the index constituents endpoint.""" | |
| result = obb.index.constituents(**params) | |
| assert result | |
| assert isinstance(result, OBBject) | |
| assert len(result.results) > 0 | |
| def test_index_price_historical(params, obb): | |
| """Test the index historical price endpoint.""" | |
| result = obb.index.price.historical(**params) | |
| assert result | |
| assert isinstance(result, OBBject) | |
| assert len(result.results) > 0 | |
| def test_index_available(params, obb): | |
| """Test the index available endpoint.""" | |
| result = obb.index.available(**params) | |
| assert result | |
| assert isinstance(result, OBBject) | |
| assert len(result.results) > 0 | |
| def test_index_search(params, obb): | |
| """Test the index search endpoint.""" | |
| result = obb.index.search(**params) | |
| assert result | |
| assert isinstance(result, OBBject) | |
| assert len(result.results) > 0 | |
| def test_index_snapshots(params, obb): | |
| """Test the index snapshots endpoint.""" | |
| result = obb.index.snapshots(**params) | |
| assert result | |
| assert isinstance(result, OBBject) | |
| assert len(result.results) > 0 | |
| def test_index_sp500_multiples(params, obb): | |
| """Test the index sp500 multiples endpoint.""" | |
| result = obb.index.sp500_multiples(**params) | |
| assert result | |
| assert isinstance(result, OBBject) | |
| assert len(result.results) > 0 | |
| def test_index_sectors(params, obb): | |
| """Test the index sectors endpoint.""" | |
| result = obb.index.sectors(**params) | |
| assert result | |
| assert isinstance(result, OBBject) | |
| assert len(result.results) > 0 | |