Resolve linter errors

This commit is contained in:
Theodore Aptekarev
2023-10-11 16:56:37 +02:00
parent 0d1c2bd6dc
commit bd590c58d7
2 changed files with 94 additions and 21 deletions

View File

@@ -15,6 +15,9 @@ def headers():
return {"Authorization": f"Basic {base64_bytes.decode('ascii')}"}
# pylint: disable=redefined-outer-name
@pytest.mark.parametrize(
"params",
[({"index": "dowjones"})],
@@ -308,7 +311,7 @@ def test_economy_cot_search(params, headers):
(
{
"code": "13874P",
"data_type": "FO",
"data_type": "FO", # cspell: disable-line
"legacy_format": True,
"report_type": "ALL",
"measure": "CR",
@@ -379,15 +382,25 @@ def test_economy_fred_index(params, headers):
assert isinstance(result, requests.Response)
assert result.status_code == 200
@pytest.mark.parametrize(
"params",
[({'units': 'usd', 'start_date': '2023-01-01', 'end_date': '2023-06-06'}),
({'country': 'united_states', 'provider': 'oecd', 'units': 'usd', 'start_date': '2023-01-01', 'end_date': '2023-06-06'})],
[
({"units": "usd", "start_date": "2023-01-01", "end_date": "2023-06-06"}),
(
{
"country": "united_states",
"provider": "oecd",
"units": "usd",
"start_date": "2023-01-01",
"end_date": "2023-06-06",
}
),
],
)
@pytest.mark.integration
def test_economy_gdpnom(params, headers):
params = {p: v for p, v in params.items() if v}
query_str = get_querystring(params, [])
url = f"http://0.0.0.0:8000/api/v1/economy/gdpnom?{query_str}"
@@ -395,15 +408,25 @@ def test_economy_gdpnom(params, headers):
assert isinstance(result, requests.Response)
assert result.status_code == 200
@pytest.mark.parametrize(
"params",
[({'units': 'yoy', 'start_date': '2023-01-01', 'end_date': '2023-06-06'}),
({'country': 'united_states', 'provider': 'oecd', 'units': 'yoy', 'start_date': '2023-01-01', 'end_date': '2023-06-06'})],
[
({"units": "yoy", "start_date": "2023-01-01", "end_date": "2023-06-06"}),
(
{
"country": "united_states",
"provider": "oecd",
"units": "yoy",
"start_date": "2023-01-01",
"end_date": "2023-06-06",
}
),
],
)
@pytest.mark.integration
def test_economy_gdpreal(params, headers):
params = {p: v for p, v in params.items() if v}
query_str = get_querystring(params, [])
url = f"http://0.0.0.0:8000/api/v1/economy/gdpreal?{query_str}"
@@ -411,15 +434,33 @@ def test_economy_gdpreal(params, headers):
assert isinstance(result, requests.Response)
assert result.status_code == 200
@pytest.mark.parametrize(
"params",
[({'period': 'annual', 'start_date': '2023-01-01', 'end_date': '2023-06-06', 'type': 'real'}),
({'country': 'united_states', 'provider': 'oecd', 'period': 'annual', 'start_date': '2023-01-01', 'end_date': '2023-06-06', 'type': 'real'})],
[
(
{
"period": "annual",
"start_date": "2023-01-01",
"end_date": "2023-06-06",
"type": "real",
}
),
(
{
"country": "united_states",
"provider": "oecd",
"period": "annual",
"start_date": "2023-01-01",
"end_date": "2023-06-06",
"type": "real",
}
),
],
)
@pytest.mark.integration
def test_economy_gdpforecast(params, headers):
params = {p: v for p, v in params.items() if v}
query_str = get_querystring(params, [])
url = f"http://0.0.0.0:8000/api/v1/economy/gdpforecast?{query_str}"

View File

@@ -5,15 +5,18 @@ from openbb_core.app.model.obbject import OBBject
@pytest.fixture(scope="session")
def obb(pytestconfig):
def obb(pytestconfig): # pylint: disable=inconsistent-return-statements
"""Fixture to setup obb."""
if pytestconfig.getoption("markexpr") != "not integration":
import openbb
import openbb # pylint: disable=import-outside-toplevel
return openbb.obb
# pylint: disable=redefined-outer-name
@pytest.mark.parametrize(
"params",
[
@@ -366,9 +369,16 @@ def test_economy_fred_index(params):
@pytest.mark.parametrize(
"params",
[
({'units': 'usd', 'start_date': '2023-01-01', 'end_date': '2023-06-06'}),
({'country': 'united_states', 'provider': 'oecd', 'units': 'usd', 'start_date': '2023-01-01', 'end_date': '2023-06-06'}),
({"units": "usd", "start_date": "2023-01-01", "end_date": "2023-06-06"}),
(
{
"country": "united_states",
"provider": "oecd",
"units": "usd",
"start_date": "2023-01-01",
"end_date": "2023-06-06",
}
),
],
)
@pytest.mark.integration
@@ -384,9 +394,16 @@ def test_economy_gdpnom(params, obb):
@pytest.mark.parametrize(
"params",
[
({'units': 'yoy', 'start_date': '2023-01-01', 'end_date': '2023-06-06'}),
({'country': 'united_states', 'provider': 'oecd', 'units': 'yoy', 'start_date': '2023-01-01', 'end_date': '2023-06-06'}),
({"units": "yoy", "start_date": "2023-01-01", "end_date": "2023-06-06"}),
(
{
"country": "united_states",
"provider": "oecd",
"units": "yoy",
"start_date": "2023-01-01",
"end_date": "2023-06-06",
}
),
],
)
@pytest.mark.integration
@@ -402,9 +419,24 @@ def test_economy_gdpreal(params, obb):
@pytest.mark.parametrize(
"params",
[
({'period': 'annual', 'start_date': '2023-01-01', 'end_date': '2023-06-06', 'type': 'real'}),
({'country': 'united_states', 'provider': 'oecd', 'period': 'annual', 'start_date': '2023-01-01', 'end_date': '2023-06-06', 'type': 'real'}),
(
{
"period": "annual",
"start_date": "2023-01-01",
"end_date": "2023-06-06",
"type": "real",
}
),
(
{
"country": "united_states",
"provider": "oecd",
"period": "annual",
"start_date": "2023-01-01",
"end_date": "2023-06-06",
"type": "real",
}
),
],
)
@pytest.mark.integration