code: def describe_validate_schema():
      def it_raises_when_struct_field_is_missing1(spark):
          data = [("jose", 1), ("li", 2), ("luisa", 3)]
          source_df = spark.createDataFrame(data, ["name", "age"])
          required_schema = StructType(
              [
                  StructField("name", StringType(), True),
                  StructField("city", StringType(), True),
              ]
          )
          with pytest.raises(
              quinn.DataFrameMissingStructFieldError
          ) as excinfo:
              quinn.validate_schema(source_df, required_schema)
  
          current_spark_version = semver.Version.parse(spark.version)
          spark_330 = semver.Version.parse("3.3.0")
          if (
              semver.Version.compare(current_spark_version, spark_330)
              >= 0
          ):  # Spark 3.3+
              expected_error_message = "The [StructField('city', StringType(), True)] StructFields are not included in the DataFrame with the following StructFields StructType([StructField('name', StringType(), True), StructField('age', LongType(), True)])"  # noqa
          else:
              expected_error_message = "The [StructField(city,StringType,true)] StructFields are not included in the DataFrame with the following StructFields StructType(List(StructField(name,StringType,true),StructField(age,LongType,true)))"  # noqa
          assert excinfo.value.args[0] == expected_error_message
  
      def it_does_nothing_when_the_schema_matches(spark):
          data = [("jose", 1), ("li", 2), ("luisa", 3)]
          source_df = spark.createDataFrame(data, ["name", "age"])
          required_schema = StructType(
              [
                  StructField("name", StringType(), True),
                  StructField("age", LongType(), True),
              ]
          )
          quinn.validate_schema(source_df, required_schema)
  
      def nullable_column_mismatches_are_ignored(spark):
          data = [("jose", 1), ("li", 2), ("luisa", 3)]
          source_df = spark.createDataFrame(data, ["name", "age"])
          required_schema = StructType(
              [
                  StructField("name", StringType(), True),
                  StructField("age", LongType(), False),
              ]
          )
          quinn.validate_schema(
              source_df, required_schema, ignore_nullable=True
          )
  
file_path: quinn/tests/test_dataframe_validator.py
imports: import pytest
  from pyspark.sql.types import StructType, StructField, StringType, LongType
  import semver
  import quinn
  from tests.conftest import auto_inject_fixtures
label_desc: Use image node_id 2 for calling a global function with example usage: describe_validate_schema() without return types