From f12b7b8fc097683730d6933adfbd37f44336ec61 Mon Sep 17 00:00:00 2001 From: Alexander Myskov Date: Thu, 19 Nov 2020 03:18:29 -0600 Subject: [PATCH] TEST-#2290: remove duplicated tests Signed-off-by: Alexander Myskov --- modin/pandas/test/test_io.py | 71 ------------------------------------ modin/pandas/test/utils.py | 10 ++--- 2 files changed, 5 insertions(+), 76 deletions(-) diff --git a/modin/pandas/test/test_io.py b/modin/pandas/test/test_io.py index 7c325c12ce7..d5b756cdc87 100644 --- a/modin/pandas/test/test_io.py +++ b/modin/pandas/test/test_io.py @@ -1105,21 +1105,6 @@ def test_from_sas(): df_equals(modin_df, pandas_df) -@pytest.mark.parametrize("nrows", [123, None]) -def test_from_csv(make_csv_file, nrows): - make_csv_file() - - pandas_df = pandas.read_csv(TEST_CSV_FILENAME, nrows=nrows) - modin_df = pd.read_csv(TEST_CSV_FILENAME, nrows=nrows) - - df_equals(modin_df, pandas_df) - - pandas_df = pandas.read_csv(Path(TEST_CSV_FILENAME), nrows=nrows) - modin_df = pd.read_csv(Path(TEST_CSV_FILENAME), nrows=nrows) - - df_equals(modin_df, pandas_df) - - @pytest.mark.parametrize("nrows", [123, None]) def test_from_csv_sep_none(make_csv_file, nrows): make_csv_file() @@ -1434,53 +1419,6 @@ def test_from_csv_chunksize(make_csv_file): df_equals(modin_df, pd_df) -@pytest.mark.parametrize("nrows", [1, 2, 123, None]) -def test_from_csv_skiprows(make_csv_file, nrows): - make_csv_file() - - pandas_df = pandas.read_csv(TEST_CSV_FILENAME, skiprows=2, nrows=nrows) - modin_df = pd.read_csv(TEST_CSV_FILENAME, skiprows=2, nrows=nrows) - df_equals(modin_df, pandas_df) - - pandas_df = pandas.read_csv( - TEST_CSV_FILENAME, names=["c1", "c2", "c3", "c4"], skiprows=2, nrows=nrows - ) - modin_df = pd.read_csv( - TEST_CSV_FILENAME, names=["c1", "c2", "c3", "c4"], skiprows=2, nrows=nrows - ) - df_equals(modin_df, pandas_df) - - pandas_df = pandas.read_csv( - TEST_CSV_FILENAME, - header=None, - names=["c1", "c2", "c3", "c4"], - skiprows=2, - nrows=nrows, - ) - modin_df = pd.read_csv( - TEST_CSV_FILENAME, - header=None, - names=["c1", "c2", "c3", "c4"], - skiprows=2, - nrows=nrows, - ) - df_equals(modin_df, pandas_df) - - pandas_df = pandas.read_csv( - TEST_CSV_FILENAME, - names=["c1", "c2", "c3", "c4"], - skiprows=lambda x: x % 2, - nrows=nrows, - ) - modin_df = pd.read_csv( - TEST_CSV_FILENAME, - names=["c1", "c2", "c3", "c4"], - skiprows=lambda x: x % 2, - nrows=nrows, - ) - df_equals(modin_df, pandas_df) - - @pytest.mark.parametrize("names", [list("XYZ"), None]) @pytest.mark.parametrize("skiprows", [1, 2, 3, 4, None]) def test_from_csv_skiprows_names(names, skiprows): @@ -1524,15 +1462,6 @@ def test_from_csv_index_col(make_csv_file, nrows): df_equals(modin_df, pandas_df) -def test_from_csv_skipfooter(make_csv_file): - make_csv_file() - - pandas_df = pandas.read_csv(TEST_CSV_FILENAME, skipfooter=13) - modin_df = pd.read_csv(TEST_CSV_FILENAME, skipfooter=13) - - df_equals(modin_df, pandas_df) - - def test_from_csv_parse_dates(make_csv_file): make_csv_file(force=True) diff --git a/modin/pandas/test/utils.py b/modin/pandas/test/utils.py index 5893582e945..0a79f78294d 100644 --- a/modin/pandas/test/utils.py +++ b/modin/pandas/test/utils.py @@ -884,15 +884,15 @@ def make_dict_hash(dict_to_hash): def _make_hash(object_to_hash): if isinstance(object_to_hash, (set, list)): - new_object = hash(frozenset(object_to_hash)) + object_hash = hash(frozenset(object_to_hash)) elif not isinstance(object_to_hash, dict): - new_object = hash(object_to_hash) + object_hash = hash(object_to_hash) elif callable(object_to_hash): - new_object = hash(object_to_hash.__name__) + object_hash = hash(object_to_hash.__name__) else: - new_object = object_to_hash + object_hash = object_to_hash - return new_object + return object_hash new_dict = {key: _make_hash(value) for key, value in dict_to_hash.items()} return hash(frozenset(new_dict))