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 3bfe059db168 [SPARK-51983][PS][TESTS][FOLLOW-UP] Replace 
`assertEquals` with `assertEqual` for python 3.12+
3bfe059db168 is described below

commit 3bfe059db1684730e211ff7ee579e74aef10c2d9
Author: Ruifeng Zheng <ruife...@apache.org>
AuthorDate: Fri May 9 12:02:50 2025 +0800

    [SPARK-51983][PS][TESTS][FOLLOW-UP] Replace `assertEquals` with 
`assertEqual` for python 3.12+
    
    ### What changes were proposed in this pull request?
    Replace `assertEquals` with `assertEqual' for python 3.12+
    
    ### Why are the changes needed?
    
    `assertEquals` was removed in 3.12, see 
https://docs.python.org/3/whatsnew/3.12.html#id3
    
    tests in python 3.12+ was broken 
https://github.com/apache/spark/actions/runs/14914041146/job/41895320048
    
    ```
    ======================================================================
    ERROR: test_align 
(pyspark.pandas.tests.diff_frames_ops.test_align.DiffFramesAlignTests.test_align)
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File "/__w/spark/spark/python/pyspark/testing/pandasutils.py", line 482, 
in setUp
        self.assertEquals(
        ^^^^^^^^^^^^^^^^^
    AttributeError: 'DiffFramesAlignTests' object has no attribute 
'assertEquals'. Did you mean: 'assertEqual'?
    
    ======================================================================
    ERROR: test_assert_classic_mode 
(pyspark.pandas.tests.diff_frames_ops.test_align.DiffFramesAlignTests.test_assert_classic_mode)
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File "/__w/spark/spark/python/pyspark/testing/pandasutils.py", line 482, 
in setUp
        self.assertEquals(
        ^^^^^^^^^^^^^^^^^
    AttributeError: 'DiffFramesAlignTests' object has no attribute 
'assertEquals'. Did you mean: 'assertEqual'?
    
    ======================================================================
    ERROR: test_assert_classic_mode 
(pyspark.testing.pandasutils.PandasOnSparkTestCase.test_assert_classic_mode)
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File "/__w/spark/spark/python/pyspark/testing/pandasutils.py", line 482, 
in setUp
        self.assertEquals(
        ^^^^^^^^^^^^^^^^^
    AttributeError: 'PandasOnSparkTestCase' object has no attribute 
'assertEquals'. Did you mean: 'assertEqual'?
    ```
    
    ### Does this PR introduce _any_ user-facing change?
    no, test-only
    
    ### How was this patch tested?
    manually test
    
    ### Was this patch authored or co-authored using generative AI tooling?
    no
    
    Closes #50842 from zhengruifeng/fix_assertEquals.
    
    Authored-by: Ruifeng Zheng <ruife...@apache.org>
    Signed-off-by: Ruifeng Zheng <ruife...@apache.org>
---
 python/pyspark/testing/pandasutils.py | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/python/pyspark/testing/pandasutils.py 
b/python/pyspark/testing/pandasutils.py
index 730212f5baa2..b55034da3f58 100644
--- a/python/pyspark/testing/pandasutils.py
+++ b/python/pyspark/testing/pandasutils.py
@@ -478,13 +478,11 @@ class PandasOnSparkTestCase(ReusedSQLTestCase, 
PandasOnSparkTestUtils):
 
     def setUp(self):
         super().setUp()
-        self.assertEquals(
-            is_ansi_mode_test, self.spark.conf.get("spark.sql.ansi.enabled") 
== "true"
-        )
+        self.assertEqual(is_ansi_mode_test, 
self.spark.conf.get("spark.sql.ansi.enabled") == "true")
 
     def tearDown(self):
         try:
-            self.assertEquals(
+            self.assertEqual(
                 is_ansi_mode_test, 
self.spark.conf.get("spark.sql.ansi.enabled") == "true"
             )
         finally:


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org
For additional commands, e-mail: commits-h...@spark.apache.org

Reply via email to