From 21dbccb5edf00a45128bfab17cd4c108b9fc3a86 Mon Sep 17 00:00:00 2001 From: Varnika Budati Date: Thu, 12 Sep 2024 11:40:36 -0700 Subject: [PATCH] fix test --- src/snowflake/snowpark/modin/plugin/extensions/index.py | 6 ++---- tests/integ/modin/index/test_index_methods.py | 4 ++-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/snowflake/snowpark/modin/plugin/extensions/index.py b/src/snowflake/snowpark/modin/plugin/extensions/index.py index a5e541c2229..0ae1815561d 100644 --- a/src/snowflake/snowpark/modin/plugin/extensions/index.py +++ b/src/snowflake/snowpark/modin/plugin/extensions/index.py @@ -757,8 +757,7 @@ def name(self, value: Hashable) -> None: self._query_compiler = self._query_compiler.set_index_names([value]) # Update the name of the parent's index only if the parent's current query compiler # matches the recorded query compiler. - if self._parent is not None: - self._parent.check_and_update_parent_qc_index_names([value]) + self._parent.check_and_update_parent_qc_index_names([value]) def _get_names(self) -> list[Hashable]: """ @@ -786,8 +785,7 @@ def _set_names(self, values: list) -> None: self._query_compiler = self._query_compiler.set_index_names(values) # Update the name of the parent's index only if the parent's current query compiler # matches the recorded query compiler. - if self._parent is not None: - self._parent.check_and_update_parent_qc_index_names(values) + self._parent.check_and_update_parent_qc_index_names(values) names = property(fset=_set_names, fget=_get_names) diff --git a/tests/integ/modin/index/test_index_methods.py b/tests/integ/modin/index/test_index_methods.py index 8d0434915ac..6b33eb89889 100644 --- a/tests/integ/modin/index/test_index_methods.py +++ b/tests/integ/modin/index/test_index_methods.py @@ -393,13 +393,13 @@ def test_index_parent(): # DataFrame case. df = pd.DataFrame([[1, 2], [3, 4]], index=native_idx1) snow_idx = df.index - assert_frame_equal(snow_idx._parent, df) + assert_frame_equal(snow_idx._parent._parent, df) assert_index_equal(snow_idx, native_idx1) # Series case. s = pd.Series([1, 2, 4, 5, 6, 7], index=native_idx2, name="zyx") snow_idx = s.index - assert_series_equal(snow_idx._parent, s) + assert_series_equal(snow_idx._parent._parent, s) assert_index_equal(snow_idx, native_idx2)