From 097b3db62a98c619aeef2e192fac8788a2f983f4 Mon Sep 17 00:00:00 2001 From: Tim Paine <3105306+timkpaine@users.noreply.github.com> Date: Fri, 9 Feb 2024 21:44:24 -0500 Subject: [PATCH 1/3] Fix new lint errors --- tributary/lazy/calculations/ops.py | 224 ++++++++++-------- tributary/lazy/output/output.py | 24 +- tributary/streaming/calculations/ops.py | 8 +- tributary/streaming/serialize.py | 6 +- tributary/streaming/utils.py | 4 +- .../tests/utils/test_extract_parameters.py | 4 +- 6 files changed, 157 insertions(+), 113 deletions(-) diff --git a/tributary/lazy/calculations/ops.py b/tributary/lazy/calculations/ops.py index 592c81e..85a1b17 100644 --- a/tributary/lazy/calculations/ops.py +++ b/tributary/lazy/calculations/ops.py @@ -89,11 +89,13 @@ def Mult(self, other): other, "{}*{}".format(self._name_no_id, other._name_no_id), ( - lambda x, y: x * y - if not self._use_dual - else ( - x[0] * y[0], - x[0] * y[1] + x[1] * y[0], + lambda x, y: ( + x * y + if not self._use_dual + else ( + x[0] * y[0], + x[0] * y[1] + x[1] * y[0], + ) ) ), ) @@ -108,11 +110,13 @@ def Div(self, other): other, "{}/{}".format(self._name_no_id, other._name_no_id), ( - lambda x, y: x / y - if not self._use_dual - else ( - x[0] / y[0], - (x[1] * y[0] - x[0] * y[1]) / y[0] ** 2, + lambda x, y: ( + x / y + if not self._use_dual + else ( + x[0] / y[0], + (x[1] * y[0] - x[0] * y[1]) / y[0] ** 2, + ) ) ), ) @@ -127,11 +131,13 @@ def RDiv(self, other): other, "{}\\{}".format(self._name_no_id, other._name_no_id), ( - lambda x, y: y / x - if not self._use_dual - else ( - y[0] / x[0], - (y[1] * x[0] - y[0] * x[1]) / x[0] ** 2, + lambda x, y: ( + y / x + if not self._use_dual + else ( + y[0] / x[0], + (y[1] * x[0] - y[0] * x[1]) / x[0] ** 2, + ) ) ), ) @@ -146,11 +152,13 @@ def Pow(self, other): other, "{}^{}".format(self._name_no_id, other._name_no_id), ( - lambda x, y: x**y - if not self._use_dual - else ( - x[0] ** y, - y * x[1] * x[0] ** (y - 1), + lambda x, y: ( + x**y + if not self._use_dual + else ( + x[0] ** y, + y * x[1] * x[0] ** (y - 1), + ) ) ), ) @@ -205,9 +213,11 @@ def Sum(self, *others): self._name_no_id, ",".join(other._name_no_id for other in others_nodes) ), ( - lambda *args: sum(x for x in args) - if not self._use_dual - else (sum([x[0] for x in args]), sum(x[1] for x in args)) + lambda *args: ( + sum(x for x in args) + if not self._use_dual + else (sum([x[0] for x in args]), sum(x[1] for x in args)) + ) ), ) @@ -230,12 +240,14 @@ def Average(self, *others): self._name_no_id, ",".join(other._name_no_id for other in others_nodes) ), ( - lambda *args: sum(x for x in args) / len(args) - if not self._use_dual - else ( - ( - sum([x[0] for x in args]) / len(args), - sum(x[1] for x in args) / len(args), + lambda *args: ( + sum(x for x in args) / len(args) + if not self._use_dual + else ( + ( + sum([x[0] for x in args]) / len(args), + sum(x[1] for x in args) / len(args), + ) ) ) ), @@ -287,11 +299,13 @@ def Sin(self): self, "sin({})".format(self._name_no_id), ( - lambda x: math.sin(x) - if not self._use_dual - else ( - math.sin(x[0]), - math.cos(x[0]) * x[1], + lambda x: ( + math.sin(x) + if not self._use_dual + else ( + math.sin(x[0]), + math.cos(x[0]) * x[1], + ) ) ), ) @@ -303,11 +317,13 @@ def Cos(self): self, "cos({})".format(self._name_no_id), ( - lambda x: math.cos(x) - if not self._use_dual - else ( - math.cos(x[0]), - -1 * math.sin(x[0]) * x[1], + lambda x: ( + math.cos(x) + if not self._use_dual + else ( + math.cos(x[0]), + -1 * math.sin(x[0]) * x[1], + ) ) ), ) @@ -319,11 +335,13 @@ def Tan(self): self, "tan({})".format(self._name_no_id), ( - lambda x: math.tan(x) - if not self._use_dual - else ( - math.tan(x[0]), - x[1] * (1 / math.cos(x[0])) ** 2, + lambda x: ( + math.tan(x) + if not self._use_dual + else ( + math.tan(x[0]), + x[1] * (1 / math.cos(x[0])) ** 2, + ) ) ), ) @@ -335,11 +353,13 @@ def Arcsin(self): self, "arcsin({})".format(self._name_no_id), ( - lambda x: math.asin(x) - if not self._use_dual - else ( - math.asin(x[0]), - x[1] / math.sqrt(1 - x[0] ** 2), + lambda x: ( + math.asin(x) + if not self._use_dual + else ( + math.asin(x[0]), + x[1] / math.sqrt(1 - x[0] ** 2), + ) ) ), ) @@ -351,11 +371,13 @@ def Arccos(self): self, "arccos({})".format(self._name_no_id), ( - lambda x: math.acos(x) - if not self._use_dual - else ( - math.acos(x[0]), - -1 * x[1] / math.sqrt(1 - x[0] ** 2), + lambda x: ( + math.acos(x) + if not self._use_dual + else ( + math.acos(x[0]), + -1 * x[1] / math.sqrt(1 - x[0] ** 2), + ) ) ), ) @@ -367,11 +389,13 @@ def Arctan(self): self, "arctan({})".format(self._name_no_id), ( - lambda x: math.atan(x) - if not self._use_dual - else ( - math.atan(x[0]), - x[1] / (1 + x[0] ** 2), + lambda x: ( + math.atan(x) + if not self._use_dual + else ( + math.atan(x[0]), + x[1] / (1 + x[0] ** 2), + ) ) ), ) @@ -383,11 +407,13 @@ def Abs(self): self, "||{}||".format(self._name_no_id), ( - lambda x: abs(x) - if not self._use_dual - else ( - abs(x[0]), - x[1] * x[0] / abs(x[0]), + lambda x: ( + abs(x) + if not self._use_dual + else ( + abs(x[0]), + x[1] * x[0] / abs(x[0]), + ) ) ), ) @@ -399,11 +425,13 @@ def Sqrt(self): self, "sqrt({})".format(self._name_no_id), ( - lambda x: math.sqrt(x) - if not self._use_dual - else ( - math.sqrt(x[0]), - x[1] * 0.5 / math.sqrt(x[0]), + lambda x: ( + math.sqrt(x) + if not self._use_dual + else ( + math.sqrt(x[0]), + x[1] * 0.5 / math.sqrt(x[0]), + ) ) ), ) @@ -415,9 +443,9 @@ def Log(self): self, "log({})".format(self._name_no_id), ( - lambda x: math.log(x) - if not self._use_dual - else (math.log(x[0]), x[1] / x[0]) + lambda x: ( + math.log(x) if not self._use_dual else (math.log(x[0]), x[1] / x[0]) + ) ), ) @@ -428,11 +456,13 @@ def Exp(self): self, "exp({})".format(self._name_no_id), ( - lambda x: math.exp(x) - if not self._use_dual - else ( - math.exp(x[0]), - x[1] * math.exp(x[0]), + lambda x: ( + math.exp(x) + if not self._use_dual + else ( + math.exp(x[0]), + x[1] * math.exp(x[0]), + ) ) ), ) @@ -444,11 +474,13 @@ def Erf(self): self, "erf({})".format(self._name_no_id), ( - lambda x: math.erf(x) - if not self._use_dual - else ( - math.erf(x[0]), - x[1] * (2 / math.sqrt(math.pi)) * math.exp(-1 * math.pow(x[0], 2)), + lambda x: ( + math.erf(x) + if not self._use_dual + else ( + math.erf(x[0]), + x[1] * (2 / math.sqrt(math.pi)) * math.exp(-1 * math.pow(x[0], 2)), + ) ) ), ) @@ -508,9 +540,11 @@ def Floor(self): self, "floor({})".format(self._name_no_id), ( - lambda x: math.floor(x) - if not self._use_dual - else (math.floor(x[0]), math.floor(x[1])) + lambda x: ( + math.floor(x) + if not self._use_dual + else (math.floor(x[0]), math.floor(x[1])) + ) ), ) @@ -521,9 +555,11 @@ def Ceil(self): self, "ceil({})".format(self._name_no_id), ( - lambda x: math.ceil(x) - if not self._use_dual - else (math.ceil(x[0]), math.ceil(x[1])) + lambda x: ( + math.ceil(x) + if not self._use_dual + else (math.ceil(x[0]), math.ceil(x[1])) + ) ), ) @@ -534,11 +570,13 @@ def Round(self, ndigits=0): self, "round({}, {})".format(self._name_no_id, ndigits), ( - lambda x: round(x, ndigits=ndigits) - if not self._use_dual - else ( - round(x[0], ndigits=ndigits), - round(x[1], ndigits=ndigits), + lambda x: ( + round(x, ndigits=ndigits) + if not self._use_dual + else ( + round(x[0], ndigits=ndigits), + round(x[1], ndigits=ndigits), + ) ) ), ) diff --git a/tributary/lazy/output/output.py b/tributary/lazy/output/output.py index 8f3bf7b..ce7e21c 100644 --- a/tributary/lazy/output/output.py +++ b/tributary/lazy/output/output.py @@ -117,25 +117,31 @@ def rec(nodes, parent): G.setNode( k._name, style="fill: #0ff", - shape="rect" - if k._graphvizshape == "box" - else k._graphvizshape, + shape=( + "rect" + if k._graphvizshape == "box" + else k._graphvizshape + ), ) elif k.isDirty(): G.setNode( k._name, style="fill: #f00", - shape="rect" - if k._graphvizshape == "box" - else k._graphvizshape, + shape=( + "rect" + if k._graphvizshape == "box" + else k._graphvizshape + ), ) else: G.setNode( k._name, style="fill: #fff", - shape="rect" - if k._graphvizshape == "box" - else k._graphvizshape, + shape=( + "rect" + if k._graphvizshape == "box" + else k._graphvizshape + ), ) rec(d[k], k) diff --git a/tributary/streaming/calculations/ops.py b/tributary/streaming/calculations/ops.py index 0bb96c5..10d3751 100644 --- a/tributary/streaming/calculations/ops.py +++ b/tributary/streaming/calculations/ops.py @@ -291,9 +291,11 @@ def __Bool__(self): def Round(self, ndigits=0): downstream = Node( - lambda x: round(x, ndigits=ndigits) - if not self._use_dual - else (round(x[0], ndigits=ndigits), round(x[1], ndigits=ndigits)), + lambda x: ( + round(x, ndigits=ndigits) + if not self._use_dual + else (round(x[0], ndigits=ndigits), round(x[1], ndigits=ndigits)) + ), {}, name="Round", inputs=1, diff --git a/tributary/streaming/serialize.py b/tributary/streaming/serialize.py index 85e82bb..097f1d3 100644 --- a/tributary/streaming/serialize.py +++ b/tributary/streaming/serialize.py @@ -11,9 +11,9 @@ def save(self): ret["input"] = [dill.dumps(_) for _ in self._input] ret["active"] = [dill.dumps(_) for _ in self._active] - ret[ - "downstream" - ] = [] # TODO think about this more [_.save() for _ in self._downstream] + ret["downstream"] = ( + [] + ) # TODO think about this more [_.save() for _ in self._downstream] ret["upstream"] = [_.save() for _ in self._upstream] ret["func"] = dill.dumps(self._func) diff --git a/tributary/streaming/utils.py b/tributary/streaming/utils.py index 917c210..a511184 100644 --- a/tributary/streaming/utils.py +++ b/tributary/streaming/utils.py @@ -255,9 +255,7 @@ def func(*values, reducer=reducer): return ( values if reducer is None - else reducer(*values, ret) - if inject_node - else reducer(*values) + else reducer(*values, ret) if inject_node else reducer(*values) ) ret = Node(func=func, name="Reduce", inputs=len(nodes)) diff --git a/tributary/tests/utils/test_extract_parameters.py b/tributary/tests/utils/test_extract_parameters.py index 713e5d3..8f53eb4 100644 --- a/tributary/tests/utils/test_extract_parameters.py +++ b/tributary/tests/utils/test_extract_parameters.py @@ -3,12 +3,12 @@ def func(a, b=1, *c, **d): - ... + pass class Test: def meth(self, a, b=1, *c, **d): - ... + pass class TestLazyToStreaming: From 6d638f90a1cc22821603f240086ac5576a3265d7 Mon Sep 17 00:00:00 2001 From: Tim Paine <3105306+timkpaine@users.noreply.github.com> Date: Fri, 9 Feb 2024 22:14:20 -0500 Subject: [PATCH 2/3] move off nosetest setup --- tributary/tests/functional/test_functional.py | 2 +- tributary/tests/streaming/input/test_file_streaming.py | 2 +- tributary/tests/streaming/input/test_http_streaming.py | 2 +- tributary/tests/streaming/input/test_input_streaming.py | 6 +++--- tributary/tests/streaming/input/test_postgres_streaming.py | 2 +- tributary/tests/streaming/input/test_process_streaming.py | 2 +- tributary/tests/streaming/output/test_file_streaming.py | 2 +- tributary/tests/streaming/output/test_http_streaming.py | 2 +- tributary/tests/streaming/output/test_kafka_streaming.py | 2 +- tributary/tests/streaming/output/test_output_streaming.py | 2 +- tributary/tests/streaming/output/test_postgres_streaming.py | 2 +- tributary/tests/streaming/output/test_socketio_streaming.py | 2 +- tributary/tests/streaming/output/test_ws_streaming.py | 2 +- tributary/tests/streaming/test_streaming.py | 2 +- tributary/tests/streaming/test_utils_streaming.py | 2 +- tributary/tests/symbolic/test_symbolic.py | 2 +- tributary/tests/test_base.py | 4 ---- tributary/tests/utils/test_lazy_to_streaming.py | 2 +- 18 files changed, 19 insertions(+), 23 deletions(-) diff --git a/tributary/tests/functional/test_functional.py b/tributary/tests/functional/test_functional.py index d2c6d39..f234c7d 100644 --- a/tributary/tests/functional/test_functional.py +++ b/tributary/tests/functional/test_functional.py @@ -4,7 +4,7 @@ class TestFunctional: - def setup(self): + def setup_method(self): time.sleep(1) @pytest.mark.skipif("os.name == 'nt'") diff --git a/tributary/tests/streaming/input/test_file_streaming.py b/tributary/tests/streaming/input/test_file_streaming.py index 1446d74..ea243b1 100644 --- a/tributary/tests/streaming/input/test_file_streaming.py +++ b/tributary/tests/streaming/input/test_file_streaming.py @@ -19,7 +19,7 @@ class TestFile: - def setup(self): + def setup_method(self): time.sleep(0.5) def test_file(self): diff --git a/tributary/tests/streaming/input/test_http_streaming.py b/tributary/tests/streaming/input/test_http_streaming.py index 0f2d5da..c4f5109 100644 --- a/tributary/tests/streaming/input/test_http_streaming.py +++ b/tributary/tests/streaming/input/test_http_streaming.py @@ -6,7 +6,7 @@ class TestHttp: - def setup(self): + def setup_method(self): time.sleep(0.5) def test_http(self): diff --git a/tributary/tests/streaming/input/test_input_streaming.py b/tributary/tests/streaming/input/test_input_streaming.py index 648d918..bf130d8 100644 --- a/tributary/tests/streaming/input/test_input_streaming.py +++ b/tributary/tests/streaming/input/test_input_streaming.py @@ -3,7 +3,7 @@ class TestConst: - def setup(self): + def setup_method(self): time.sleep(0.5) def test_const_1(self): @@ -16,7 +16,7 @@ def test_const_2(self): class TestTimer: - def setup(self): + def setup_method(self): time.sleep(0.5) def test_timer(self): @@ -87,7 +87,7 @@ def func(): class TestFunc: - def setup(self): + def setup_method(self): time.sleep(0.5) def test_timer(self): diff --git a/tributary/tests/streaming/input/test_postgres_streaming.py b/tributary/tests/streaming/input/test_postgres_streaming.py index a56ab24..3fdc4d9 100644 --- a/tributary/tests/streaming/input/test_postgres_streaming.py +++ b/tributary/tests/streaming/input/test_postgres_streaming.py @@ -4,7 +4,7 @@ class TestPostgres: - def setup(self): + def setup_method(self): time.sleep(0.5) @pytest.mark.skipif("int(os.environ.get('TRIBUTARY_SKIP_DOCKER_TESTS', '1'))") diff --git a/tributary/tests/streaming/input/test_process_streaming.py b/tributary/tests/streaming/input/test_process_streaming.py index c7b39c8..99388f3 100644 --- a/tributary/tests/streaming/input/test_process_streaming.py +++ b/tributary/tests/streaming/input/test_process_streaming.py @@ -19,7 +19,7 @@ class TestProcess: - def setup(self): + def setup_method(self): time.sleep(0.5) @pytest.mark.skipif("'--cov=tributary' in sys.argv") diff --git a/tributary/tests/streaming/output/test_file_streaming.py b/tributary/tests/streaming/output/test_file_streaming.py index 522e850..44edafa 100644 --- a/tributary/tests/streaming/output/test_file_streaming.py +++ b/tributary/tests/streaming/output/test_file_streaming.py @@ -4,7 +4,7 @@ class TestFile: - def setup(self): + def setup_method(self): time.sleep(0.5) def test_file(self): diff --git a/tributary/tests/streaming/output/test_http_streaming.py b/tributary/tests/streaming/output/test_http_streaming.py index 8f5ca51..358268c 100644 --- a/tributary/tests/streaming/output/test_http_streaming.py +++ b/tributary/tests/streaming/output/test_http_streaming.py @@ -6,7 +6,7 @@ class TestHttp: - def setup(self): + def setup_method(self): time.sleep(0.5) @pytest.mark.skipif("int(os.environ.get('TRIBUTARY_SKIP_DOCKER_TESTS', '1'))") diff --git a/tributary/tests/streaming/output/test_kafka_streaming.py b/tributary/tests/streaming/output/test_kafka_streaming.py index e91418d..e8d955e 100644 --- a/tributary/tests/streaming/output/test_kafka_streaming.py +++ b/tributary/tests/streaming/output/test_kafka_streaming.py @@ -4,7 +4,7 @@ class TestKafka: - def setup(self): + def setup_method(self): time.sleep(0.5) @pytest.mark.skipif("int(os.environ.get('TRIBUTARY_SKIP_DOCKER_TESTS', '1'))") diff --git a/tributary/tests/streaming/output/test_output_streaming.py b/tributary/tests/streaming/output/test_output_streaming.py index 81b2892..19c5591 100644 --- a/tributary/tests/streaming/output/test_output_streaming.py +++ b/tributary/tests/streaming/output/test_output_streaming.py @@ -3,7 +3,7 @@ class TestOutput: - def setup(self): + def setup_method(self): time.sleep(0.5) def test_print(self): diff --git a/tributary/tests/streaming/output/test_postgres_streaming.py b/tributary/tests/streaming/output/test_postgres_streaming.py index fb676c6..e780d03 100644 --- a/tributary/tests/streaming/output/test_postgres_streaming.py +++ b/tributary/tests/streaming/output/test_postgres_streaming.py @@ -4,7 +4,7 @@ class TestPostgres: - def setup(self): + def setup_method(self): time.sleep(0.5) @pytest.mark.skipif("int(os.environ.get('TRIBUTARY_SKIP_DOCKER_TESTS', '1'))") diff --git a/tributary/tests/streaming/output/test_socketio_streaming.py b/tributary/tests/streaming/output/test_socketio_streaming.py index fae6291..7c5f5c0 100644 --- a/tributary/tests/streaming/output/test_socketio_streaming.py +++ b/tributary/tests/streaming/output/test_socketio_streaming.py @@ -4,7 +4,7 @@ class TestSocketIO: - def setup(self): + def setup_method(self): time.sleep(0.5) @pytest.mark.skipif("int(os.environ.get('TRIBUTARY_SKIP_DOCKER_TESTS', '1'))") diff --git a/tributary/tests/streaming/output/test_ws_streaming.py b/tributary/tests/streaming/output/test_ws_streaming.py index 687bd45..fabc22c 100644 --- a/tributary/tests/streaming/output/test_ws_streaming.py +++ b/tributary/tests/streaming/output/test_ws_streaming.py @@ -4,7 +4,7 @@ class TestWebSocket: - def setup(self): + def setup_method(self): time.sleep(0.5) @pytest.mark.skipif("int(os.environ.get('TRIBUTARY_SKIP_DOCKER_TESTS', '1'))") diff --git a/tributary/tests/streaming/test_streaming.py b/tributary/tests/streaming/test_streaming.py index 507e094..50bdbd3 100644 --- a/tributary/tests/streaming/test_streaming.py +++ b/tributary/tests/streaming/test_streaming.py @@ -4,7 +4,7 @@ class TestStreaming: - def setup(self): + def setup_method(self): time.sleep(0.5) def test_run_simple(self): diff --git a/tributary/tests/streaming/test_utils_streaming.py b/tributary/tests/streaming/test_utils_streaming.py index 26364ba..d2b999b 100644 --- a/tributary/tests/streaming/test_utils_streaming.py +++ b/tributary/tests/streaming/test_utils_streaming.py @@ -19,7 +19,7 @@ def func2(): class TestUtils: - def setup(self): + def setup_method(self): time.sleep(0.2) def test_delay(self): diff --git a/tributary/tests/symbolic/test_symbolic.py b/tributary/tests/symbolic/test_symbolic.py index 1965165..390275a 100644 --- a/tributary/tests/symbolic/test_symbolic.py +++ b/tributary/tests/symbolic/test_symbolic.py @@ -8,7 +8,7 @@ class TestConfig: - def setup(self): + def setup_method(self): time.sleep(0.5) def test_construct_lazy(self): diff --git a/tributary/tests/test_base.py b/tributary/tests/test_base.py index 7802464..90fedcd 100644 --- a/tributary/tests/test_base.py +++ b/tributary/tests/test_base.py @@ -1,8 +1,4 @@ class TestBase: - def setup(self): - pass - # setup() before each test method - def test_1(self): from tributary.base import StreamNone diff --git a/tributary/tests/utils/test_lazy_to_streaming.py b/tributary/tests/utils/test_lazy_to_streaming.py index 58084ac..249b2dc 100644 --- a/tributary/tests/utils/test_lazy_to_streaming.py +++ b/tributary/tests/utils/test_lazy_to_streaming.py @@ -5,7 +5,7 @@ class TestLazyToStreaming: - def setup(self): + def setup_method(self): time.sleep(0.5) def test_function(self): From 1ec60d2397c2300da46eb50839330409d0de3d67 Mon Sep 17 00:00:00 2001 From: Tim Paine <3105306+timkpaine@users.noreply.github.com> Date: Fri, 9 Feb 2024 22:29:13 -0500 Subject: [PATCH 3/3] Remove pandas helper function, move to superstore --- setup.py | 1 + .../tests/lazy/calculations/test_finance_lazy.py | 11 +++-------- .../streaming/calculations/test_finance_streaming.py | 11 +++-------- 3 files changed, 7 insertions(+), 16 deletions(-) diff --git a/setup.py b/setup.py index 8853063..d8e995f 100644 --- a/setup.py +++ b/setup.py @@ -61,6 +61,7 @@ def get_version(file, name="__version__"): "pybind11>=2.4.0", "pytest>=4.3.0", "pytest-cov>=2.6.1", + "superstore", "Sphinx>=1.8.4", "sphinx-markdown-builder>=0.5.2", ] + requires diff --git a/tributary/tests/lazy/calculations/test_finance_lazy.py b/tributary/tests/lazy/calculations/test_finance_lazy.py index 13b2686..006e26b 100644 --- a/tributary/tests/lazy/calculations/test_finance_lazy.py +++ b/tributary/tests/lazy/calculations/test_finance_lazy.py @@ -1,13 +1,11 @@ import pandas as pd +import superstore import tributary.lazy as tl class TestFinance: def test_rsi(self): - try: - df = pd.DataFrame(pd.util.testing.getTimeSeriesData(20)) - except AttributeError: - df = pd.DataFrame(pd._testing.getTimeSeriesData(20)) + df = pd.DataFrame(superstore.getTimeSeriesData(20)) adjust = False period = 14 delta = df["A"].diff().shift(-1) @@ -34,10 +32,7 @@ def test_rsi(self): assert n_rsi().tolist() == rsi.tolist() def test_macd(self): - try: - df = pd.DataFrame(pd.util.testing.getTimeSeriesData(20)) - except AttributeError: - df = pd.DataFrame(pd._testing.getTimeSeriesData(20)) + df = pd.DataFrame(superstore.getTimeSeriesData(20)) period_fast = 12 period_slow = 26 diff --git a/tributary/tests/streaming/calculations/test_finance_streaming.py b/tributary/tests/streaming/calculations/test_finance_streaming.py index b965c94..f60c8ad 100644 --- a/tributary/tests/streaming/calculations/test_finance_streaming.py +++ b/tributary/tests/streaming/calculations/test_finance_streaming.py @@ -1,13 +1,11 @@ import pandas as pd +import superstore import tributary.streaming as ts class TestFinance: def test_rsi(self): - try: - vals = pd.DataFrame(pd.util.testing.getTimeSeriesData(20)) - except AttributeError: - vals = pd.DataFrame(pd._testing.getTimeSeriesData(20)) + vals = pd.DataFrame(superstore.getTimeSeriesData(20)) adjust = False period = 14 delta = vals["A"].diff().shift(-1) @@ -28,10 +26,7 @@ def test_rsi(self): assert abs(x - y) < 0.001 def test_macd(self): - try: - vals = pd.DataFrame(pd.util.testing.getTimeSeriesData(20)) - except AttributeError: - vals = pd.DataFrame(pd._testing.getTimeSeriesData(20)) + vals = pd.DataFrame(superstore.getTimeSeriesData(20)) period_fast = 12 period_slow = 26 signal = 9