From 3df04008d696ccb2e602b48547ce86d1831c0b52 Mon Sep 17 00:00:00 2001 From: Joe Schr <8218910+TheJoeSchr@users.noreply.github.com> Date: Mon, 26 Feb 2024 11:03:04 +0100 Subject: [PATCH] fix tests: move orderflow tests into own dir --- tests/data/test_converter_public_trades.py | 26 ++++++++---------- tests/testdata/{ => orderflow}/candles.json | 0 .../populate_dataframe_with_trades_DF.feather | Bin ...ulate_dataframe_with_trades_TRADES.feather | Bin .../{ => orderflow}/public_trades_list.csv | 0 .../public_trades_list_simple_example.csv | 0 6 files changed, 11 insertions(+), 15 deletions(-) rename tests/testdata/{ => orderflow}/candles.json (100%) rename tests/testdata/{ => orderflow}/populate_dataframe_with_trades_DF.feather (100%) rename tests/testdata/{ => orderflow}/populate_dataframe_with_trades_TRADES.feather (100%) rename tests/testdata/{ => orderflow}/public_trades_list.csv (100%) rename tests/testdata/{ => orderflow}/public_trades_list_simple_example.csv (100%) diff --git a/tests/data/test_converter_public_trades.py b/tests/data/test_converter_public_trades.py index 43602d806..0b2e4668a 100644 --- a/tests/data/test_converter_public_trades.py +++ b/tests/data/test_converter_public_trades.py @@ -19,37 +19,27 @@ def read_csv(filename, converter_columns: list = ['side', 'type']): @pytest.fixture def populate_dataframe_with_trades_dataframe(testdatadir): - return pd.read_feather(testdatadir / 'populate_dataframe_with_trades_DF.feather') + return pd.read_feather(testdatadir / 'orderflow/populate_dataframe_with_trades_DF.feather') @pytest.fixture def populate_dataframe_with_trades_trades(testdatadir): - return pd.read_feather(testdatadir / 'populate_dataframe_with_trades_TRADES.feather') + return pd.read_feather(testdatadir / 'orderflow/populate_dataframe_with_trades_TRADES.feather') @pytest.fixture def candles(testdatadir): - return pd.read_json(testdatadir / 'candles.json').copy() + return pd.read_json(testdatadir / 'orderflow/candles.json').copy() @pytest.fixture def public_trades_list(testdatadir): - return read_csv(testdatadir / 'public_trades_list.csv').copy() + return read_csv(testdatadir / 'orderflow/public_trades_list.csv').copy() @pytest.fixture def public_trades_list_simple(testdatadir): - return read_csv(testdatadir / 'public_trades_list_simple_example.csv').copy() - - -@pytest.fixture -def public_trades_list_simple_results(testdatadir): - return read_csv(testdatadir / 'public_trades_list_simple_results.csv').copy() - - -@pytest.fixture -def public_trades_list_simple_bidask(testdatadir): - return read_csv(testdatadir / 'public_trades_list_simple_bidask.csv').copy() + return read_csv(testdatadir / 'orderflow/public_trades_list_simple_example.csv').copy() def test_public_trades_columns_before_change( @@ -65,6 +55,12 @@ def test_public_trades_columns_before_change( def test_public_trades_mock_populate_dataframe_with_trades__check_orderflow( populate_dataframe_with_trades_dataframe, populate_dataframe_with_trades_trades): + """ + Tests the `populate_dataframe_with_trades` function's order flow calculation. + + This test checks the generated data frame and order flow for specific properties + based on the provided configuration and sample data. + """ dataframe = populate_dataframe_with_trades_dataframe.copy() trades = populate_dataframe_with_trades_trades.copy() dataframe['date'] = pd.to_datetime( diff --git a/tests/testdata/candles.json b/tests/testdata/orderflow/candles.json similarity index 100% rename from tests/testdata/candles.json rename to tests/testdata/orderflow/candles.json diff --git a/tests/testdata/populate_dataframe_with_trades_DF.feather b/tests/testdata/orderflow/populate_dataframe_with_trades_DF.feather similarity index 100% rename from tests/testdata/populate_dataframe_with_trades_DF.feather rename to tests/testdata/orderflow/populate_dataframe_with_trades_DF.feather diff --git a/tests/testdata/populate_dataframe_with_trades_TRADES.feather b/tests/testdata/orderflow/populate_dataframe_with_trades_TRADES.feather similarity index 100% rename from tests/testdata/populate_dataframe_with_trades_TRADES.feather rename to tests/testdata/orderflow/populate_dataframe_with_trades_TRADES.feather diff --git a/tests/testdata/public_trades_list.csv b/tests/testdata/orderflow/public_trades_list.csv similarity index 100% rename from tests/testdata/public_trades_list.csv rename to tests/testdata/orderflow/public_trades_list.csv diff --git a/tests/testdata/public_trades_list_simple_example.csv b/tests/testdata/orderflow/public_trades_list_simple_example.csv similarity index 100% rename from tests/testdata/public_trades_list_simple_example.csv rename to tests/testdata/orderflow/public_trades_list_simple_example.csv