code: def test_accessing_spark_session_through_df(self):
      dataframe = self.spark.createDataFrame(
          [("do", "not"), ("serialize", "dataframe")]
      )
  
      class TestListener(StreamingQueryListener):
          def onQueryStarted(self, event):
              dataframe.collect()
  
          def onQueryProgress(self, event):
              pass
  
          def onQueryIdle(self, event):
              pass
  
          def onQueryTerminated(self, event):
              pass
  
      error_thrown = False
      try:
          self.spark.streams.addListener(TestListener())
      except PySparkPicklingError as e:
          self.assertEqual(
              e.getErrorClass(), "STREAMING_CONNECT_SERIALIZATION_ERROR"
          )
          error_thrown = True
      self.assertTrue(error_thrown)
  
imports: import unittest
  import time
  import pyspark.cloudpickle
  from pyspark.errors import PySparkPicklingError
  from pyspark.sql.tests.streaming.test_streaming_listener import StreamingListenerTestsMixin
  from pyspark.sql.streaming.listener import StreamingQueryListener
  from pyspark.sql.functions import count, lit
  from pyspark.testing.connectutils import ReusedConnectTestCase
label_desc: Use image node_id 3 for calling the StreamingListenerParityTests obj's underlying member method code with example usage: obj.test_accessing_spark_session_through_df() without return types