This is an automated email from the ASF dual-hosted git repository. gurwls223 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 8bbb666 [SPARK-25351][PYTHON][TEST][FOLLOWUP] Fix test assertions to be consistent 8bbb666 is described below commit 8bbb666622e042c1533da294ac7b504b6aaa694a Author: Bryan Cutler <cutl...@gmail.com> AuthorDate: Thu May 28 10:27:15 2020 +0900 [SPARK-25351][PYTHON][TEST][FOLLOWUP] Fix test assertions to be consistent ### What changes were proposed in this pull request? Followup to make assertions from recent test consistent with the rest of the module ### Why are the changes needed? Better to use assertions from `unittest` and be consistent ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? Existing tests Closes #28659 from BryanCutler/arrow-category-test-fix-SPARK-25351. Authored-by: Bryan Cutler <cutl...@gmail.com> Signed-off-by: HyukjinKwon <gurwls...@apache.org> --- python/pyspark/sql/tests/test_arrow.py | 9 +++++---- python/pyspark/sql/tests/test_pandas_udf_scalar.py | 9 +++------ 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/python/pyspark/sql/tests/test_arrow.py b/python/pyspark/sql/tests/test_arrow.py index c3c9fb0..c59765d 100644 --- a/python/pyspark/sql/tests/test_arrow.py +++ b/python/pyspark/sql/tests/test_arrow.py @@ -435,11 +435,12 @@ class ArrowTests(ReusedSQLTestCase): assert_frame_equal(result_spark, result_arrow) # ensure original category elements are string - assert isinstance(category_first_element, str) + self.assertIsInstance(category_first_element, str) # spark data frame and arrow execution mode enabled data frame type must match pandas - assert spark_type == arrow_type == 'string' - assert isinstance(arrow_first_category_element, str) - assert isinstance(spark_first_category_element, str) + self.assertEqual(spark_type, 'string') + self.assertEqual(arrow_type, 'string') + self.assertIsInstance(arrow_first_category_element, str) + self.assertIsInstance(spark_first_category_element, str) @unittest.skipIf( diff --git a/python/pyspark/sql/tests/test_pandas_udf_scalar.py b/python/pyspark/sql/tests/test_pandas_udf_scalar.py index ae6b8d5..2d38efd 100644 --- a/python/pyspark/sql/tests/test_pandas_udf_scalar.py +++ b/python/pyspark/sql/tests/test_pandas_udf_scalar.py @@ -910,13 +910,10 @@ class ScalarPandasUDFTests(ReusedSQLTestCase): spark_type = df.dtypes[1][1] # spark data frame and arrow execution mode enabled data frame type must match pandas - assert spark_type == 'string' + self.assertEqual(spark_type, 'string') - # Check result value of column 'B' must be equal to column 'A' - for i in range(0, len(result_spark["A"])): - assert result_spark["A"][i] == result_spark["B"][i] - assert isinstance(result_spark["A"][i], str) - assert isinstance(result_spark["B"][i], str) + # Check result of column 'B' must be equal to column 'A' in type and values + pd.testing.assert_series_equal(result_spark["A"], result_spark["B"], check_names=False) @unittest.skipIf(sys.version_info[:2] < (3, 5), "Type hints are supported from Python 3.5.") def test_type_annotation(self): --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org For additional commands, e-mail: commits-h...@spark.apache.org