code: def comparePoolWithExpectedData(
      sparkSession,
      pool,
      expectedDataSchema,
      expectedData,
      expectedFeatureNames,
      expectedPairsData=None,
      expectedPairsDataSchema=None,
      # set to true if order of rows might change. Requires sampleId or (groupId, sampleId) in data
      compareByIds=False,
  ):
      expectedDf = sparkSession.createDataFrame(
          sparkSession.sparkContext.parallelize(expectedData),
          StructType(expectedDataSchema),
      )
  
      assert all(pool.getFeatureNames == expectedFeatureNames)
  
      assert pool.data.schema == StructType(expectedDataSchema)
  
      if compareByIds:
          expectedDataToCompare = expectedDf.orderBy(
              pool.getOrDefault(pool.groupIdCol),
              pool.getOrDefault(pool.sampleIdCol),
          )
          poolDataToCompare = pool.data.orderBy(
              pool.getOrDefault(pool.groupIdCol),
              pool.getOrDefault(pool.sampleIdCol),
          )
      else:
          expectedDataToCompare = expectedDf
          poolDataToCompare = pool.data
  
      test_helpers.assertEqualsWithPrecision(
          expectedDataToCompare, poolDataToCompare
      )
  
      if expectedPairsData:
          poolPairsDataToCompare = pool.pairsData.orderBy(
              "groupId", "winnerId", "loserId"
          )
          expectedPairsDataToCompare = spark.createDataFrame(
              sparkSesion.sparkContext.parallelize(expectedPairsData),
              StructType(expectedPairsDataSchema),
          ).orderBy("groupId", "winnerId", "loserId")
          assert pool.pairsData
          test_helpers.assertEqualsWithPrecision(
              expectedPairsDataToCompare, poolPairsDataToCompare
          )
      else:
          assert not pool.pairsData
  
file_path: catboost/catboost/spark/catboost4j-spark/core/src/test/python/pool_test_helpers.py
imports: import tempfile
  from pyspark.ml.linalg import *
  from pyspark.ml.param import *
  from pyspark.sql import *
  from pyspark.sql.types import *
  import test_helpers
label_desc: Use image node_id 3 for calling a global function with example usage: comparePoolWithExpectedData(sparkSession, pool, expectedDataSchema, expectedData, expectedFeatureNames, expectedPairsData, expectedPairsDataSchema, compareByIds) without return types