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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to