You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2022/01/18 04:31:35 UTC

[GitHub] [spark] itholic commented on a change in pull request #35236: [SPARK-37903][PYTHON][FOLLOW-UP] Raise TypeError with no return function

itholic commented on a change in pull request #35236:
URL: https://github.com/apache/spark/pull/35236#discussion_r786408066



##########
File path: python/pyspark/pandas/tests/test_typedef.py
##########
@@ -56,6 +56,23 @@
 
 
 class TypeHintTests(unittest.TestCase):
+    def test_infer_schema_with_no_return(self):
+        def try_infer_return_type():
+            def f():
+                pass
+
+            infer_return_type(f)
+
+        self.assertRaisesRegex(TypeError, "Unsupported callable", try_infer_return_type)
+
+        def try_infer_return_type():
+            def f() -> None:
+                pass
+
+            infer_return_type(f)
+
+        self.assertRaisesRegex(TypeError, "not understood", try_infer_return_type)

Review comment:
       This too, It would be great if we can show the message more explicitly.
   
   e.g. "None type is not acceptable for the function passed to `infer_return_type`."
   
   or something.

##########
File path: python/pyspark/pandas/tests/test_typedef.py
##########
@@ -56,6 +56,23 @@
 
 
 class TypeHintTests(unittest.TestCase):
+    def test_infer_schema_with_no_return(self):
+        def try_infer_return_type():
+            def f():
+                pass
+
+            infer_return_type(f)
+
+        self.assertRaisesRegex(TypeError, "Unsupported callable", try_infer_return_type)

Review comment:
       Can we refine the message bit more explicitly ??
   
   e.g. "A return value is required for the function passed to `infer_return_type`."
   
   or something.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org