From 0e20868e92fed6add4bb9f03a996c86a243a384c Mon Sep 17 00:00:00 2001 From: "Natalia.Murycheva" Date: Thu, 19 Jun 2025 22:16:10 +0200 Subject: [PATCH] [PyCharm Tables] PY-80834 Fixed test data and tests (cherry picked from commit c1c344c53e2ec1ad91e423f59c4f062c25678f39) IJ-CR-166515 GitOrigin-RevId: 152abd4bbb6df85b9fa3a373f8992898864348e8 --- .../test_data/pandas/python_3_12/series_describe.txt | 9 ++++++--- .../test_data/pandas/python_3_8/series_describe.txt | 10 +++++----- .../pydev/pydev_tests_tables/test_pydev_pandas.py | 9 ++++++--- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/python/helpers/pydev/pydev_tests_tables/test_data/pandas/python_3_12/series_describe.txt b/python/helpers/pydev/pydev_tests_tables/test_data/pandas/python_3_12/series_describe.txt index a4b439ec3b1c..d9a6b47ef543 100644 --- a/python/helpers/pydev/pydev_tests_tables/test_data/pandas/python_3_12/series_describe.txt +++ b/python/helpers/pydev/pydev_tests_tables/test_data/pandas/python_3_12/series_describe.txt @@ -1,8 +1,8 @@ {'count': 4.0, 'mean': 1.0, 'std': 0.0, 'min': 1.0, '5%': 1.0, '25%': 1.0, '50%': 1.0, '75%': 1.0, '95%': 1.0, 'max': 1.0} {'count': 4, 'unique': 1, 'top': 'foo', 'freq': 4} {'count': 0, 'unique': 0, 'top': nan, 'freq': nan} - - +{'count': 4} +{'count': 4} {'count': 3, 'unique': 3, 'top': 'bar', 'freq': 1} {'count': 3, 'unique': 3, 'top': 'bar', 'freq': 1} {'count': 4, 'unique': 2, 'top': True, 'freq': 2} @@ -17,4 +17,7 @@ {'count': 4, 'unique': 4, 'top': 'A', 'freq': 1} {'count': 4, 'unique': 3, 'top': [1, 2], 'freq': 2} {'count': 4, 'unique': 3, 'top': {1: 2}, 'freq': 2} -{'count': 4, 'unique': 3, 'top': (1, 2), 'freq': 2} \ No newline at end of file +{'count': 4, 'unique': 3, 'top': (1, 2), 'freq': 2} +{'count': 4} +{'count': 4} +{'count': 4} \ No newline at end of file diff --git a/python/helpers/pydev/pydev_tests_tables/test_data/pandas/python_3_8/series_describe.txt b/python/helpers/pydev/pydev_tests_tables/test_data/pandas/python_3_8/series_describe.txt index cbbf40e1dd6d..2cfa52f37337 100644 --- a/python/helpers/pydev/pydev_tests_tables/test_data/pandas/python_3_8/series_describe.txt +++ b/python/helpers/pydev/pydev_tests_tables/test_data/pandas/python_3_8/series_describe.txt @@ -1,8 +1,8 @@ {'count': 4.0, 'mean': 1.0, 'std': 0.0, 'min': 1.0, '5%': 1.0, '25%': 1.0, '50%': 1.0, '75%': 1.0, '95%': 1.0, 'max': 1.0} {'count': 4, 'unique': 1, 'top': 'foo', 'freq': 4} {'count': 0, 'unique': 0, 'top': nan, 'freq': nan} -{'count': (4+0j), 'mean': (1+20j), 'std': (nan+0j), 'min': (1+20j), '5%': (1+20j), '25%': (1+20j), '50%': (1+20j), '75%': (1+20j), '95%': (1+20j), 'max': (1+20j)} -{'count': (4+0j), 'mean': (1+20j), 'std': (nan+0j), 'min': (1+20j), '5%': (1+20j), '25%': (1+20j), '50%': (1+20j), '75%': (1+20j), '95%': (1+20j), 'max': (1+20j)} +{'count': 4} +{'count': 4} {'count': 3, 'unique': 3, 'top': 'bar', 'freq': 1} {'count': 3, 'unique': 3, 'top': 'bar', 'freq': 1} {'count': 4, 'unique': 2, 'top': True, 'freq': 2} @@ -15,6 +15,6 @@ {'count': 4, 'mean': Timestamp('2013-01-02 12:00:00+0100', tz='CET'), 'min': Timestamp('2013-01-01 00:00:00+0100', tz='CET'), '5%': Timestamp('2013-01-01 03:36:00+0100', tz='CET'), '25%': Timestamp('2013-01-01 18:00:00+0100', tz='CET'), '50%': Timestamp('2013-01-02 12:00:00+0100', tz='CET'), '75%': Timestamp('2013-01-03 06:00:00+0100', tz='CET'), '95%': Timestamp('2013-01-03 20:24:00+0100', tz='CET'), 'max': Timestamp('2013-01-04 00:00:00+0100', tz='CET')} {'count': 4, 'unique': 1, 'top': Period('2012-01-01', 'D'), 'freq': 4} {'count': 4, 'unique': 4, 'top': 'A', 'freq': 1} -{'count': 4, 'unique': 3, 'top': [1, 2], 'freq': 2} -{'count': 4, 'unique': 3, 'top': {1: 2}, 'freq': 2} -{'count': 4, 'unique': 3, 'top': (1, 2), 'freq': 2} \ No newline at end of file +{'count': 4} +{'count': 4} +{'count': 4} \ No newline at end of file diff --git a/python/helpers/pydev/pydev_tests_tables/test_pydev_pandas.py b/python/helpers/pydev/pydev_tests_tables/test_pydev_pandas.py index bf5d96e27d1a..57dc447138fd 100644 --- a/python/helpers/pydev/pydev_tests_tables/test_pydev_pandas.py +++ b/python/helpers/pydev/pydev_tests_tables/test_pydev_pandas.py @@ -343,8 +343,8 @@ def test_describe_shape_all_types(setup_dataframe): assert describe_df.shape[0] == 13 # the number of columns should be the same assert describe_df.shape[1] == df.shape[1] - # check that we excluded only 2 columns from describe - assert len(describe_df.columns[describe_df.isna().all()].tolist()) == 2 + # check that we don't exclude any column from the describe function + assert len(describe_df.columns[describe_df.isna().all()].tolist()) == 0 # 11 @@ -403,7 +403,10 @@ def test_describe_series(setup_dataframe): reason="The exception will be raised during df creation in Python2") def test_overflow_error_is_caught(setup_df_with_big_int_values): df = setup_df_with_big_int_values - assert pandas_tables_helpers.__get_describe(df) is None + actual_result = pandas_tables_helpers.__get_describe(df) + assert actual_result is not None + expected_result = pd.Series(data={"count": 2}, index=["count"], name="BitIntValues") + assert (actual_result.values == expected_result.values).all() # 15