From acd134ed40ad8ca6269a341d4967cf0a6341f05c Mon Sep 17 00:00:00 2001 From: edtechre Date: Sun, 17 Mar 2024 10:59:07 -0700 Subject: [PATCH] Remove tests/util --- tests/fixtures.py | 11 +++++++++++ tests/test_data.py | 1 - tests/test_indicator.py | 1 - tests/test_model.py | 1 - tests/test_strategy.py | 1 - tests/util.py | 11 ----------- 6 files changed, 11 insertions(+), 15 deletions(-) delete mode 100644 tests/util.py diff --git a/tests/fixtures.py b/tests/fixtures.py index 359cd03..584aac2 100644 --- a/tests/fixtures.py +++ b/tests/fixtures.py @@ -35,6 +35,7 @@ StaticScope, ) from pybroker.vect import highv, lowv, sumv +from typing import NamedTuple MODEL_NAME = "fake_model" @@ -48,6 +49,16 @@ def predict(self, _): return self._preds +class LazyFixture(NamedTuple): + name: str + + +def get_fixture(request, param): + if isinstance(param, LazyFixture): + return request.getfixturevalue(param.name) + return param + + @pytest.fixture() def data_source_df(): return pd.read_pickle( diff --git a/tests/test_data.py b/tests/test_data.py index 223945c..70b5e92 100644 --- a/tests/test_data.py +++ b/tests/test_data.py @@ -13,7 +13,6 @@ import re import yfinance from .fixtures import * # noqa: F401 -from .util import * # noqa: F401 from datetime import datetime from pybroker.cache import DataSourceCacheKey from pybroker.common import to_seconds diff --git a/tests/test_indicator.py b/tests/test_indicator.py index 18a1567..63658ba 100644 --- a/tests/test_indicator.py +++ b/tests/test_indicator.py @@ -12,7 +12,6 @@ import re from pybroker.cache import CacheDateFields from .fixtures import * # noqa: F401 -from .util import * # noqa: F401 from pybroker.common import BarData, DataCol, IndicatorSymbol, to_datetime from pybroker.indicator import ( Indicator, diff --git a/tests/test_model.py b/tests/test_model.py index 4a8786a..b3a8c14 100644 --- a/tests/test_model.py +++ b/tests/test_model.py @@ -10,7 +10,6 @@ import pytest import re from .fixtures import * # noqa: F401 -from .util import * # noqa: F401 from unittest.mock import Mock from pybroker.cache import CacheDateFields from pybroker.common import ModelSymbol, TrainedModel, to_datetime diff --git a/tests/test_strategy.py b/tests/test_strategy.py index 10aa03f..7c4c231 100644 --- a/tests/test_strategy.py +++ b/tests/test_strategy.py @@ -12,7 +12,6 @@ import pytest import re from .fixtures import * # noqa: F401 -from .util import * # noqa: F401 from collections import defaultdict, deque from datetime import datetime from decimal import Decimal diff --git a/tests/util.py b/tests/util.py deleted file mode 100644 index 3ca6a30..0000000 --- a/tests/util.py +++ /dev/null @@ -1,11 +0,0 @@ -from typing import NamedTuple - - -class LazyFixture(NamedTuple): - name: str - - -def get_fixture(request, param): - if isinstance(param, LazyFixture): - return request.getfixturevalue(param.name) - return param