code: def test_stopiteration_in_udf(self):
      def foo(x):
          raise StopIteration()
  
      exc_message = "StopIteration"
      df = self.spark.range(0, 100)
  
      # plain udf (test for SPARK-23754)
      self.assertRaisesRegex(
          PythonException,
          exc_message,
          df.withColumn("v", udf(foo)("id")).collect,
      )
  
      # pandas scalar udf
      self.assertRaisesRegex(
          PythonException,
          exc_message,
          df.withColumn(
              "v", pandas_udf(foo, "double", PandasUDFType.SCALAR)("id")
          ).collect,
      )
  
imports: import unittest
  import datetime
  from typing import cast
  from pyspark.sql.functions import udf, pandas_udf, PandasUDFType, assert_true, lit
  from pyspark.sql.types import DoubleType, StructType, StructField, LongType, DayTimeIntervalType
  from pyspark.errors import ParseException, PythonException, PySparkTypeError
  from pyspark.rdd import PythonEvalType
  from pyspark.testing.sqlutils import ReusedSQLTestCase, have_pandas, have_pyarrow, pandas_requirement_message, pyarrow_requirement_message
  from pyspark.testing.utils import QuietTest
label_desc: Use image node_id 7 for calling the PandasUDFTestsMixin obj's underlying member method code with example usage: obj.test_stopiteration_in_udf() without return types