title: How do I test this function?
body: <p>I have this function:</p>
  <pre><code># spark already defined somewhere as:
  spark = SparkSession.builder.appName(&quot;App&quot;).getOrCreate()
  
  def read_data(spark):
      query = &quot;SELECT * FROM table&quot;
      pandas_df = pd.read_sql(query, conn)
      return spark.createDataFrame(pandas_df)
  </code></pre>
  <p>To test it:</p>
  <pre><code>from unittest import mock
  
  @mock.patch(&quot;pandas.read_sql&quot;)
  @mock.patch(&quot;pyspark.sql.SparkSession&quot;, autospec=True)
  def test_read_data(spark_session, pandas_read_sql):
      result = read_data(spark_session)
      assert == ???
  </code></pre>
  <p>In what way should I test this that makes sense? Any help appreciated.</p>