This is an automated email from the ASF dual-hosted git repository.
ruifengz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git
The following commit(s) were added to refs/heads/master by this push:
new bac3492980a3 [SPARK-46341][PS][TESTS] Reorganize
`SeriesInterpolateTests`
bac3492980a3 is described below
commit bac3492980a3e793065a9e9d511ddf0fb66357b3
Author: Ruifeng Zheng <[email protected]>
AuthorDate: Sun Dec 10 09:35:14 2023 +0800
[SPARK-46341][PS][TESTS] Reorganize `SeriesInterpolateTests`
### What changes were proposed in this pull request?
1, Move `SeriesInterpolateTests` to `pyspark.pandas.tests.series.*`
2, also optimize the test by control the combinations
### Why are the changes needed?
move it to the right place
### Does this PR introduce _any_ user-facing change?
no, test-only
### How was this patch tested?
ci
### Was this patch authored or co-authored using generative AI tooling?
no
Closes #44274 from zhengruifeng/ps_test_series_interpolate.
Authored-by: Ruifeng Zheng <[email protected]>
Signed-off-by: Ruifeng Zheng <[email protected]>
---
dev/sparktestsupport/modules.py | 4 +--
.../test_parity_interpolate.py} | 12 ++++---
.../test_interpolate.py} | 37 +++++++++++++---------
3 files changed, 31 insertions(+), 22 deletions(-)
diff --git a/dev/sparktestsupport/modules.py b/dev/sparktestsupport/modules.py
index ca35fdabc0c4..e1193d02ec51 100644
--- a/dev/sparktestsupport/modules.py
+++ b/dev/sparktestsupport/modules.py
@@ -735,7 +735,7 @@ pyspark_pandas = Module(
"pyspark.pandas.tests.test_frame_spark",
"pyspark.pandas.tests.test_generic_functions",
"pyspark.pandas.tests.test_frame_interpolate",
- "pyspark.pandas.tests.test_series_interpolate",
+ "pyspark.pandas.tests.series.test_interpolate",
"pyspark.pandas.tests.test_indexops_spark",
"pyspark.pandas.tests.test_internal",
"pyspark.pandas.tests.test_namespace",
@@ -1112,7 +1112,7 @@ pyspark_pandas_connect_part2 = Module(
"pyspark.pandas.tests.connect.indexes.test_parity_base_slow",
"pyspark.pandas.tests.connect.indexes.test_parity_datetime_property",
"pyspark.pandas.tests.connect.test_parity_frame_interpolate",
- "pyspark.pandas.tests.connect.test_parity_series_interpolate",
+ "pyspark.pandas.tests.connect.series.test_parity_interpolate",
"pyspark.pandas.tests.connect.resample.test_parity_frame",
"pyspark.pandas.tests.connect.resample.test_parity_series",
"pyspark.pandas.tests.connect.window.test_parity_ewm_error",
diff --git
a/python/pyspark/pandas/tests/connect/test_parity_series_interpolate.py
b/python/pyspark/pandas/tests/connect/series/test_parity_interpolate.py
similarity index 77%
rename from
python/pyspark/pandas/tests/connect/test_parity_series_interpolate.py
rename to python/pyspark/pandas/tests/connect/series/test_parity_interpolate.py
index 55a804b280d3..d3f753d0dbf2 100644
--- a/python/pyspark/pandas/tests/connect/test_parity_series_interpolate.py
+++ b/python/pyspark/pandas/tests/connect/series/test_parity_interpolate.py
@@ -16,19 +16,21 @@
#
import unittest
-from pyspark.pandas.tests.test_series_interpolate import
SeriesInterpolateTestsMixin
+from pyspark.pandas.tests.series.test_interpolate import SeriesInterpolateMixin
from pyspark.testing.connectutils import ReusedConnectTestCase
-from pyspark.testing.pandasutils import PandasOnSparkTestUtils, TestUtils
+from pyspark.testing.pandasutils import PandasOnSparkTestUtils
-class SeriesInterpolateParityTests(
- SeriesInterpolateTestsMixin, TestUtils, PandasOnSparkTestUtils,
ReusedConnectTestCase
+class SeriesParityInterpolateTests(
+ SeriesInterpolateMixin,
+ PandasOnSparkTestUtils,
+ ReusedConnectTestCase,
):
pass
if __name__ == "__main__":
- from pyspark.pandas.tests.connect.test_parity_series_interpolate import *
# noqa: F401
+ from pyspark.pandas.tests.connect.series.test_parity_interpolate import *
# noqa: F401
try:
import xmlrunner # type: ignore[import]
diff --git a/python/pyspark/pandas/tests/test_series_interpolate.py
b/python/pyspark/pandas/tests/series/test_interpolate.py
similarity index 72%
rename from python/pyspark/pandas/tests/test_series_interpolate.py
rename to python/pyspark/pandas/tests/series/test_interpolate.py
index 0f15bf59dede..0008dd2ee916 100644
--- a/python/pyspark/pandas/tests/test_series_interpolate.py
+++ b/python/pyspark/pandas/tests/series/test_interpolate.py
@@ -18,24 +18,28 @@ import numpy as np
import pandas as pd
import pyspark.pandas as ps
-from pyspark.testing.pandasutils import PandasOnSparkTestCase, TestUtils
+from pyspark.testing.pandasutils import PandasOnSparkTestCase
-class SeriesInterpolateTestsMixin:
+class SeriesInterpolateMixin:
def _test_interpolate(self, pobj):
psobj = ps.from_pandas(pobj)
self.assert_eq(psobj.interpolate(), pobj.interpolate())
- for limit in range(1, 5):
- for limit_direction in [None, "forward", "backward", "both"]:
- for limit_area in [None, "inside", "outside"]:
- self.assert_eq(
- psobj.interpolate(
- limit=limit, limit_direction=limit_direction,
limit_area=limit_area
- ),
- pobj.interpolate(
- limit=limit, limit_direction=limit_direction,
limit_area=limit_area
- ),
- )
+ for limit, limit_direction, limit_area in [
+ (1, None, None),
+ (2, "forward", "inside"),
+ (3, "backward", "outside"),
+ (4, "backward", "inside"),
+ (5, "both", "inside"),
+ ]:
+ self.assert_eq(
+ psobj.interpolate(
+ limit=limit, limit_direction=limit_direction,
limit_area=limit_area
+ ),
+ pobj.interpolate(
+ limit=limit, limit_direction=limit_direction,
limit_area=limit_area
+ ),
+ )
def test_interpolate(self):
pser = pd.Series(
@@ -79,13 +83,16 @@ class SeriesInterpolateTestsMixin:
self._test_interpolate(pser)
-class SeriesInterpolateTests(SeriesInterpolateTestsMixin,
PandasOnSparkTestCase, TestUtils):
+class SeriesInterpolateTests(
+ SeriesInterpolateMixin,
+ PandasOnSparkTestCase,
+):
pass
if __name__ == "__main__":
import unittest
- from pyspark.pandas.tests.test_series_interpolate import * # noqa: F401
+ from pyspark.pandas.tests.series.test_interpolate import * # noqa: F401
try:
import xmlrunner
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]