From b952799629fa157c4833b4b77b9c3b1f313b78ff Mon Sep 17 00:00:00 2001 From: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com> Date: Mon, 25 Sep 2023 18:24:27 +0200 Subject: [PATCH] Updates --- .../forex/integration/test_forex_api.py | 2 ++ .../stocks/integration/test_stocks_python.py | 16 +++++++++++----- .../tests/utils/integration_test_generator.py | 3 ++- .../utils/integration_tests_api_generator.py | 6 ++++-- 4 files changed, 19 insertions(+), 8 deletions(-) diff --git a/openbb_sdk/extensions/forex/integration/test_forex_api.py b/openbb_sdk/extensions/forex/integration/test_forex_api.py index 43d28cdb3a2..d8346b9ad6e 100644 --- a/openbb_sdk/extensions/forex/integration/test_forex_api.py +++ b/openbb_sdk/extensions/forex/integration/test_forex_api.py @@ -1,3 +1,5 @@ +import datetime + import pytest import requests from openbb_provider.utils.helpers import get_querystring diff --git a/openbb_sdk/extensions/stocks/integration/test_stocks_python.py b/openbb_sdk/extensions/stocks/integration/test_stocks_python.py index 29f4da62722..f335156f5b9 100644 --- a/openbb_sdk/extensions/stocks/integration/test_stocks_python.py +++ b/openbb_sdk/extensions/stocks/integration/test_stocks_python.py @@ -281,7 +281,13 @@ def test_stocks_fa_ins(params): @pytest.mark.parametrize( "params", [ - ({"symbol": "AAPL", "include_current_quarter": True, "date": "2023-01-01"}), + ( + { + "symbol": "AAPL", + "include_current_quarter": True, + "date": datetime.date(2023, 1, 1), + } + ), ], ) def test_stocks_fa_ins_own(params): @@ -333,7 +339,7 @@ def test_stocks_fa_overview(params): @pytest.mark.parametrize( "params", [ - ({"symbol": "AAPL", "date": "2023-01-01", "page": 1}), + ({"symbol": "AAPL", "date": datetime.date(2023, 1, 1), "page": 1}), ], ) def test_stocks_fa_own(params): @@ -478,7 +484,7 @@ def test_stocks_ca_peers(params): "params", [ ({"symbol": "AAPL"}), - ({"date": "2023-01-01", "provider": "intrinio", "symbol": "AAPL"}), + ({"date": datetime.date(2023, 1, 1), "provider": "intrinio", "symbol": "AAPL"}), ], ) def test_stocks_options_chains(params): @@ -590,7 +596,7 @@ def test_stocks_load(params): ( { "display": "full", - "date": "2023-01-01", + "date": datetime.date(2023, 1, 1), "start_date": datetime.date(2023, 1, 1), "end_date": datetime.date(2023, 6, 6), "updated_since": 1, @@ -610,7 +616,7 @@ def test_stocks_load(params): ), ( { - "published_utc": "2023-01-01", + "published_utc": datetime.date(2023, 1, 1), "order": "desc", "provider": "polygon", "symbols": "AAPL", diff --git a/openbb_sdk/extensions/tests/utils/integration_test_generator.py b/openbb_sdk/extensions/tests/utils/integration_test_generator.py index 11d867e11d8..8627fe92b45 100644 --- a/openbb_sdk/extensions/tests/utils/integration_test_generator.py +++ b/openbb_sdk/extensions/tests/utils/integration_test_generator.py @@ -3,6 +3,7 @@ from pathlib import Path, PosixPath from typing import Any, Dict, List, Literal, get_origin from pydantic.fields import ModelField + from sdk.core.openbb_core.app.provider_interface import ProviderInterface from sdk.core.openbb_core.app.router import CommandMap @@ -150,7 +151,7 @@ def test_{test_name}(params): for test_params in test_params_list: params += f"({test_params}),\n" - read_file = open(test_file) + read_file = open(test_file) # noqa if full_command_name not in read_file.read(): f.write( template.format( diff --git a/openbb_sdk/extensions/tests/utils/integration_tests_api_generator.py b/openbb_sdk/extensions/tests/utils/integration_tests_api_generator.py index 482a5a60e08..0ab4f68adff 100644 --- a/openbb_sdk/extensions/tests/utils/integration_tests_api_generator.py +++ b/openbb_sdk/extensions/tests/utils/integration_tests_api_generator.py @@ -66,7 +66,7 @@ def test_{route.replace("/", "_")[1:]}(params, headers): def test_exists(route: str, path: str): - with open(path, "r") as f: + with open(path) as f: return route.replace("/", "_")[1:] in f.read() @@ -129,4 +129,6 @@ if __name__ == "__main__": ) if commands_not_found_in_openapi: - print(f"Commands not found in openapi.json: {commands_not_found_in_openapi}") + print( # noqa + f"Commands not found in openapi.json: {commands_not_found_in_openapi}" + )