forked from apache/spark
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SPARK-46419][PS][TESTS] Reorganize
DatetimeIndexTests
: Factor out …
…3 slow tests ### What changes were proposed in this pull request? Reorganize `DatetimeIndexTests`: Factor out 3 slow tests ### Why are the changes needed? its parity test is slow, sometime take > 10 mins, this PR move 3 slow tests from it. (will move other slow tests in a followup to control the change) ### Does this PR introduce _any_ user-facing change? no ### How was this patch tested? test-only ### Was this patch authored or co-authored using generative AI tooling? no Closes apache#44369 from zhengruifeng/ps_test_idx_dt_I. Authored-by: Ruifeng Zheng <ruifengz@apache.org> Signed-off-by: Hyukjin Kwon <gurwls223@apache.org>
- Loading branch information
1 parent
a1b0da2
commit 3d447c2
Showing
11 changed files
with
343 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
python/pyspark/pandas/tests/connect/indexes/test_parity_datetime_at.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one or more | ||
# contributor license agreements. See the NOTICE file distributed with | ||
# this work for additional information regarding copyright ownership. | ||
# The ASF licenses this file to You under the Apache License, Version 2.0 | ||
# (the "License"); you may not use this file except in compliance with | ||
# the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
import unittest | ||
|
||
from pyspark.pandas.tests.indexes.test_datetime_at import DatetimeIndexAtMixin | ||
from pyspark.testing.connectutils import ReusedConnectTestCase | ||
from pyspark.testing.pandasutils import PandasOnSparkTestUtils | ||
|
||
|
||
class DatetimeIndexAtParityTests( | ||
DatetimeIndexAtMixin, | ||
PandasOnSparkTestUtils, | ||
ReusedConnectTestCase, | ||
): | ||
pass | ||
|
||
|
||
if __name__ == "__main__": | ||
from pyspark.pandas.tests.connect.indexes.test_parity_datetime_at import * # noqa: F401 | ||
|
||
try: | ||
import xmlrunner # type: ignore[import] | ||
|
||
testRunner = xmlrunner.XMLTestRunner(output="target/test-reports", verbosity=2) | ||
except ImportError: | ||
testRunner = None | ||
unittest.main(testRunner=testRunner, verbosity=2) |
41 changes: 41 additions & 0 deletions
41
python/pyspark/pandas/tests/connect/indexes/test_parity_datetime_between.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one or more | ||
# contributor license agreements. See the NOTICE file distributed with | ||
# this work for additional information regarding copyright ownership. | ||
# The ASF licenses this file to You under the Apache License, Version 2.0 | ||
# (the "License"); you may not use this file except in compliance with | ||
# the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
import unittest | ||
|
||
from pyspark.pandas.tests.indexes.test_datetime_between import DatetimeIndexBetweenMixin | ||
from pyspark.testing.connectutils import ReusedConnectTestCase | ||
from pyspark.testing.pandasutils import PandasOnSparkTestUtils | ||
|
||
|
||
class DatetimeIndexBetweenParityTests( | ||
DatetimeIndexBetweenMixin, | ||
PandasOnSparkTestUtils, | ||
ReusedConnectTestCase, | ||
): | ||
pass | ||
|
||
|
||
if __name__ == "__main__": | ||
from pyspark.pandas.tests.connect.indexes.test_parity_datetime_between import * # noqa: F401 | ||
|
||
try: | ||
import xmlrunner # type: ignore[import] | ||
|
||
testRunner = xmlrunner.XMLTestRunner(output="target/test-reports", verbosity=2) | ||
except ImportError: | ||
testRunner = None | ||
unittest.main(testRunner=testRunner, verbosity=2) |
41 changes: 41 additions & 0 deletions
41
python/pyspark/pandas/tests/connect/indexes/test_parity_datetime_ceil.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one or more | ||
# contributor license agreements. See the NOTICE file distributed with | ||
# this work for additional information regarding copyright ownership. | ||
# The ASF licenses this file to You under the Apache License, Version 2.0 | ||
# (the "License"); you may not use this file except in compliance with | ||
# the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
import unittest | ||
|
||
from pyspark.pandas.tests.indexes.test_datetime_ceil import DatetimeIndexCeilMixin | ||
from pyspark.testing.connectutils import ReusedConnectTestCase | ||
from pyspark.testing.pandasutils import PandasOnSparkTestUtils | ||
|
||
|
||
class DatetimeIndexCeilParityTests( | ||
DatetimeIndexCeilMixin, | ||
PandasOnSparkTestUtils, | ||
ReusedConnectTestCase, | ||
): | ||
pass | ||
|
||
|
||
if __name__ == "__main__": | ||
from pyspark.pandas.tests.connect.indexes.test_parity_datetime_ceil import * # noqa: F401 | ||
|
||
try: | ||
import xmlrunner # type: ignore[import] | ||
|
||
testRunner = xmlrunner.XMLTestRunner(output="target/test-reports", verbosity=2) | ||
except ImportError: | ||
testRunner = None | ||
unittest.main(testRunner=testRunner, verbosity=2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one or more | ||
# contributor license agreements. See the NOTICE file distributed with | ||
# this work for additional information regarding copyright ownership. | ||
# The ASF licenses this file to You under the Apache License, Version 2.0 | ||
# (the "License"); you may not use this file except in compliance with | ||
# the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
import datetime | ||
|
||
import pandas as pd | ||
|
||
import pyspark.pandas as ps | ||
from pyspark.testing.pandasutils import PandasOnSparkTestCase | ||
from pyspark.pandas.tests.indexes.test_datetime import DatetimeIndexTestingFuncMixin | ||
|
||
|
||
class DatetimeIndexAtMixin(DatetimeIndexTestingFuncMixin): | ||
def test_indexer_at_time(self): | ||
for psidx, pidx in self.idx_pairs: | ||
self.assert_eq( | ||
psidx.indexer_at_time("00:00:00").sort_values(), | ||
pd.Index(pidx.indexer_at_time("00:00:00")), | ||
) | ||
|
||
self.assert_eq( | ||
psidx.indexer_at_time(datetime.time(0, 1, 0)).sort_values(), | ||
pd.Index(pidx.indexer_at_time(datetime.time(0, 1, 0))), | ||
) | ||
|
||
self.assert_eq( | ||
psidx.indexer_at_time("00:00:01").sort_values(), | ||
pd.Index(pidx.indexer_at_time("00:00:01")), | ||
) | ||
|
||
self.assertRaises( | ||
NotImplementedError, | ||
lambda: ps.DatetimeIndex([0]).indexer_at_time("00:00:00", asof=True), | ||
) | ||
|
||
|
||
class DatetimeIndexAtTests( | ||
DatetimeIndexAtMixin, | ||
PandasOnSparkTestCase, | ||
): | ||
pass | ||
|
||
|
||
if __name__ == "__main__": | ||
import unittest | ||
from pyspark.pandas.tests.indexes.test_datetime_at import * # noqa: F401 | ||
|
||
try: | ||
import xmlrunner | ||
|
||
testRunner = xmlrunner.XMLTestRunner(output="target/test-reports", verbosity=2) | ||
except ImportError: | ||
testRunner = None | ||
unittest.main(testRunner=testRunner, verbosity=2) |
Oops, something went wrong.