Download openbb_platform/extensions/crypto/integration/test_crypto_python.py from CatPtain/OpenBB: direct link, hf CLI and curl.
- Browser
- Download file 3.1 kB
-
https://huggingface.co/spaces/CatPtain/OpenBB/resolve/main/openbb_platform/extensions/crypto/integration/test_crypto_python.py
- Command line
-
hf download hf://spaces/CatPtain/OpenBB/openbb_platform/extensions/crypto/integration/test_crypto_python.py
-
curl -L -o test_crypto_python.py https://huggingface.co/spaces/CatPtain/OpenBB/resolve/main/openbb_platform/extensions/crypto/integration/test_crypto_python.py
3.1 kB
| """Test crypto extension.""" | |
| import pytest | |
| from extensions.tests.conftest import parametrize | |
| from openbb_core.app.model.obbject import OBBject | |
| # pylint: disable=redefined-outer-name | |
| 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 | |
| def test_crypto_search(params, obb): | |
| """Test the crypto search endpoint.""" | |
| params = {p: v for p, v in params.items() if v} | |
| result = obb.crypto.search(**params) | |
| assert result | |
| assert isinstance(result, OBBject) | |
| assert len(result.results) > 0 | |
| def test_crypto_price_historical(params, obb): | |
| """Test crypto price historical.""" | |
| result = obb.crypto.price.historical(**params) | |
| assert result | |
| assert isinstance(result, OBBject) | |
| assert len(result.results) > 0 | |