Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Enhancement] - PyDocstyle Compliant #6284

Merged
merged 22 commits into from
Apr 9, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

@pytest.fixture(scope="session")
def headers():
"""Get the headers for the API request."""
userpass = f"{Env().API_USERNAME}:{Env().API_PASSWORD}"
userpass_bytes = userpass.encode("ascii")
base64_bytes = base64.b64encode(userpass_bytes)
Expand Down Expand Up @@ -49,6 +50,7 @@ def headers():
)
@pytest.mark.integration
def test_currency_search(params, headers):
"""Test the currency search endpoint."""
params = {p: v for p, v in params.items() if v}

query_str = get_querystring(params, [])
Expand Down Expand Up @@ -141,6 +143,7 @@ def test_currency_search(params, headers):
)
@pytest.mark.integration
def test_currency_price_historical(params, headers):
"""Test the currency historical price endpoint."""
params = {p: v for p, v in params.items() if v}

query_str = get_querystring(params, [])
Expand All @@ -156,6 +159,7 @@ def test_currency_price_historical(params, headers):
)
@pytest.mark.integration
def test_currency_reference_rates(params, headers):
"""Test the currency reference rates endpoint."""
params = {p: v for p, v in params.items() if v}

query_str = get_querystring(params, [])
Expand All @@ -180,6 +184,7 @@ def test_currency_reference_rates(params, headers):
)
@pytest.mark.integration
def test_currency_snapshots(params, headers):
"""Test the currency snapshots endpoint."""
params = {p: v for p, v in params.items() if v}

query_str = get_querystring(params, [])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ def obb(pytestconfig):
)
@pytest.mark.integration
def test_currency_search(params, obb):
"""Test the currency search endpoint."""
result = obb.currency.search(**params)
assert result
assert isinstance(result, OBBject)
Expand Down Expand Up @@ -136,6 +137,7 @@ def test_currency_search(params, obb):
)
@pytest.mark.integration
def test_currency_price_historical(params, obb):
"""Test the currency historical price endpoint."""
result = obb.currency.price.historical(**params)
assert result
assert isinstance(result, OBBject)
Expand All @@ -148,6 +150,7 @@ def test_currency_price_historical(params, obb):
)
@pytest.mark.integration
def test_currency_reference_rates(params, obb):
"""Test the currency reference rates endpoint."""
result = obb.currency.reference_rates(**params)
assert result
assert isinstance(result, OBBject)
Expand All @@ -169,6 +172,7 @@ def test_currency_reference_rates(params, obb):
)
@pytest.mark.integration
def test_currency_snapshots(params, obb):
"""Test the currency snapshots endpoint."""
result = obb.currency.snapshots(**params)
assert result
assert isinstance(result, OBBject)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ async def reference_rates(
standard_params: StandardParams,
extra_params: ExtraParams,
) -> OBBject:
"""Current, official, currency reference rates.
"""Get current, official, currency reference rates.

Foreign exchange reference rates are the exchange rates set by a major financial institution or regulatory body,
serving as a benchmark for the value of currencies around the world.
Expand Down
18 changes: 18 additions & 0 deletions openbb_platform/extensions/economy/integration/test_economy_api.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"""Test Economy API."""

import base64

import pytest
Expand All @@ -9,6 +11,7 @@

@pytest.fixture(scope="session")
def headers():
"""Get the headers for the API request."""
userpass = f"{Env().API_USERNAME}:{Env().API_PASSWORD}"
userpass_bytes = userpass.encode("ascii")
base64_bytes = base64.b64encode(userpass_bytes)
Expand Down Expand Up @@ -49,6 +52,7 @@ def headers():
)
@pytest.mark.integration
def test_economy_calendar(params, headers):
"""Test the economy calendar endpoint."""
params = {p: v for p, v in params.items() if v}

query_str = get_querystring(params, [])
Expand Down Expand Up @@ -87,6 +91,7 @@ def test_economy_calendar(params, headers):
)
@pytest.mark.integration
def test_economy_cpi(params, headers):
"""Test the economy CPI endpoint."""
params = {p: v for p, v in params.items() if v}

query_str = get_querystring(params, [])
Expand All @@ -102,6 +107,7 @@ def test_economy_cpi(params, headers):
)
@pytest.mark.integration
def test_economy_risk_premium(params, headers):
"""Test the economy risk premium endpoint."""
params = {p: v for p, v in params.items() if v}

query_str = get_querystring(params, [])
Expand Down Expand Up @@ -137,6 +143,7 @@ def test_economy_risk_premium(params, headers):
)
@pytest.mark.integration
def test_economy_gdp_forecast(params, headers):
"""Test the economy GDP forecast endpoint."""
params = {p: v for p, v in params.items() if v}

query_str = get_querystring(params, [])
Expand Down Expand Up @@ -170,6 +177,7 @@ def test_economy_gdp_forecast(params, headers):
)
@pytest.mark.integration
def test_economy_gdp_nominal(params, headers):
"""Test the economy GDP nominal endpoint."""
params = {p: v for p, v in params.items() if v}

query_str = get_querystring(params, [])
Expand Down Expand Up @@ -203,6 +211,7 @@ def test_economy_gdp_nominal(params, headers):
)
@pytest.mark.integration
def test_economy_gdp_real(params, headers):
"""Test the economy GDP real endpoint."""
params = {p: v for p, v in params.items() if v}

query_str = get_querystring(params, [])
Expand Down Expand Up @@ -243,6 +252,7 @@ def test_economy_gdp_real(params, headers):
)
@pytest.mark.integration
def test_economy_balance_of_payments(params, headers):
"""Test the economy balance of payments endpoint."""
params = {p: v for p, v in params.items() if v}

query_str = get_querystring(params, [])
Expand Down Expand Up @@ -319,6 +329,7 @@ def test_economy_balance_of_payments(params, headers):
)
@pytest.mark.integration
def test_economy_fred_search(params, headers):
"""Test the economy FRED search endpoint."""
params = {p: v for p, v in params.items() if v}

query_str = get_querystring(params, [])
Expand Down Expand Up @@ -358,6 +369,7 @@ def test_economy_fred_search(params, headers):
)
@pytest.mark.integration
def test_economy_fred_series(params, headers):
"""Test the economy FRED series endpoint."""
params = {p: v for p, v in params.items() if v}

query_str = get_querystring(params, [])
Expand All @@ -383,6 +395,7 @@ def test_economy_fred_series(params, headers):
)
@pytest.mark.integration
def test_economy_money_measures(params, headers):
"""Test the economy money measures endpoint."""
params = {p: v for p, v in params.items() if v}

query_str = get_querystring(params, [])
Expand Down Expand Up @@ -412,6 +425,7 @@ def test_economy_money_measures(params, headers):
)
@pytest.mark.integration
def test_economy_unemployment(params, headers):
"""Test the economy unemployment endpoint."""
params = {p: v for p, v in params.items() if v}

query_str = get_querystring(params, [])
Expand All @@ -437,6 +451,7 @@ def test_economy_unemployment(params, headers):
)
@pytest.mark.integration
def test_economy_composite_leading_indicator(params, headers):
"""Test the economy composite leading indicator endpoint."""
params = {p: v for p, v in params.items() if v}

query_str = get_querystring(params, [])
Expand All @@ -463,6 +478,7 @@ def test_economy_composite_leading_indicator(params, headers):
)
@pytest.mark.integration
def test_economy_short_term_interest_rate(params, headers):
"""Test the economy short term interest rate endpoint."""
params = {p: v for p, v in params.items() if v}

query_str = get_querystring(params, [])
Expand All @@ -489,6 +505,7 @@ def test_economy_short_term_interest_rate(params, headers):
)
@pytest.mark.integration
def test_economy_long_term_interest_rate(params, headers):
"""Test the economy long term interest rate endpoint."""
params = {p: v for p, v in params.items() if v}

query_str = get_querystring(params, [])
Expand Down Expand Up @@ -537,6 +554,7 @@ def test_economy_long_term_interest_rate(params, headers):
)
@pytest.mark.integration
def test_economy_fred_regional(params, headers):
"""Test the economy FRED regional endpoint."""
params = {p: v for p, v in params.items() if v}

query_str = get_querystring(params, [])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ def obb(pytestconfig): # pylint: disable=inconsistent-return-statements
)
@pytest.mark.integration
def test_economy_calendar(params, obb):
"""Test economy calendar."""
params = {p: v for p, v in params.items() if v}

result = obb.economy.calendar(**params)
Expand All @@ -69,6 +70,7 @@ def test_economy_calendar(params, obb):
)
@pytest.mark.integration
def test_economy_cpi(params, obb):
"""Test economy cpi."""
result = obb.economy.cpi(**params)
assert result
assert isinstance(result, OBBject)
Expand All @@ -83,6 +85,7 @@ def test_economy_cpi(params, obb):
)
@pytest.mark.integration
def test_economy_risk_premium(params, obb):
"""Test economy risk premium."""
result = obb.economy.risk_premium(**params)
assert result
assert isinstance(result, OBBject)
Expand Down Expand Up @@ -114,6 +117,7 @@ def test_economy_risk_premium(params, obb):
)
@pytest.mark.integration
def test_economy_gdp_forecast(params, obb):
"""Test economy gdp forecast."""
params = {p: v for p, v in params.items() if v}

result = obb.economy.gdp.forecast(**params)
Expand All @@ -139,6 +143,7 @@ def test_economy_gdp_forecast(params, obb):
)
@pytest.mark.integration
def test_economy_gdp_nominal(params, obb):
"""Test economy gdp nominal."""
params = {p: v for p, v in params.items() if v}

result = obb.economy.gdp.nominal(**params)
Expand All @@ -164,6 +169,7 @@ def test_economy_gdp_nominal(params, obb):
)
@pytest.mark.integration
def test_economy_gdp_real(params, obb):
"""Test economy gdp real."""
params = {p: v for p, v in params.items() if v}

result = obb.economy.gdp.real(**params)
Expand Down Expand Up @@ -203,6 +209,7 @@ def test_economy_gdp_real(params, obb):
)
@pytest.mark.integration
def test_economy_balance_of_payments(params, obb):
"""Test economy balance of payments."""
params = {p: v for p, v in params.items() if v}

result = obb.economy.balance_of_payments(**params)
Expand Down Expand Up @@ -278,6 +285,7 @@ def test_economy_balance_of_payments(params, obb):
)
@pytest.mark.integration
def test_economy_fred_search(params, obb):
"""Test economy fred search."""
params = {p: v for p, v in params.items() if v}

result = obb.economy.fred_search(**params)
Expand Down Expand Up @@ -316,6 +324,7 @@ def test_economy_fred_search(params, obb):
)
@pytest.mark.integration
def test_economy_fred_series(params, obb):
"""Test economy fred series."""
params = {p: v for p, v in params.items() if v}

result = obb.economy.fred_series(**params)
Expand All @@ -340,6 +349,7 @@ def test_economy_fred_series(params, obb):
)
@pytest.mark.integration
def test_economy_money_measures(params, obb):
"""Test economy money measures."""
params = {p: v for p, v in params.items() if v}

result = obb.economy.money_measures(**params)
Expand Down Expand Up @@ -368,6 +378,7 @@ def test_economy_money_measures(params, obb):
)
@pytest.mark.integration
def test_economy_unemployment(params, obb):
"""Test economy unemployment."""
params = {p: v for p, v in params.items() if v}

result = obb.economy.unemployment(**params)
Expand All @@ -392,6 +403,7 @@ def test_economy_unemployment(params, obb):
)
@pytest.mark.integration
def test_economy_composite_leading_indicator(params, obb):
"""Test economy composite leading indicator."""
params = {p: v for p, v in params.items() if v}

result = obb.economy.composite_leading_indicator(**params)
Expand All @@ -417,6 +429,7 @@ def test_economy_composite_leading_indicator(params, obb):
)
@pytest.mark.integration
def test_economy_short_term_interest_rate(params, obb):
"""Test economy short term interest rate."""
params = {p: v for p, v in params.items() if v}

result = obb.economy.short_term_interest_rate(**params)
Expand All @@ -442,6 +455,7 @@ def test_economy_short_term_interest_rate(params, obb):
)
@pytest.mark.integration
def test_economy_long_term_interest_rate(params, obb):
"""Test economy long term interest rate."""
params = {p: v for p, v in params.items() if v}

result = obb.economy.long_term_interest_rate(**params)
Expand Down Expand Up @@ -489,6 +503,7 @@ def test_economy_long_term_interest_rate(params, obb):
)
@pytest.mark.integration
def test_economy_fred_regional(params, obb):
"""Test economy fred regional."""
params = {p: v for p, v in params.items() if v}

result = obb.economy.fred_regional(**params)
Expand Down
Loading
Loading