code: def _test_sort_struct_flat(spark, sort_order: str):
      def _get_simple_test_dataframes(
          sort_order,
      ) -> tuple[(DataFrame, DataFrame)]:
          col_a = 1
          col_b = 2
          col_c = 3
  
          unsorted_fields = StructType(
              [
                  StructField("b", IntegerType()),
                  StructField("c", IntegerType()),
                  StructField("a", IntegerType()),
              ]
          )
          unsorted_data = [
              (col_b, col_c, col_a),
          ]
          if sort_order == "asc":
              sorted_fields = StructType(
                  [
                      StructField("a", IntegerType()),
                      StructField("b", IntegerType()),
                      StructField("c", IntegerType()),
                  ]
              )
  
              sorted_data = [
                  (col_a, col_b, col_c),
              ]
          elif sort_order == "desc":
              sorted_fields = StructType(
                  [
                      StructField("c", IntegerType()),
                      StructField("b", IntegerType()),
                      StructField("a", IntegerType()),
                  ]
              )
  
              sorted_data = [
                  (col_c, col_b, col_a),
              ]
          else:
              raise ValueError(
                  "['asc', 'desc'] are the only valid sort orders and you entered a sort order of '{sort_order}'".format(
                      sort_order=sort_order
                  )
              )
  
          unsorted_df = spark.createDataFrame(
              unsorted_data, unsorted_fields
          )
          expected_df = spark.createDataFrame(
              sorted_data, sorted_fields
          )
  
          return unsorted_df, expected_df
  
      unsorted_df, expected_df = _get_simple_test_dataframes(
          sort_order=sort_order
      )
      sorted_df = quinn.sort_columns(unsorted_df, sort_order)
  
      chispa.schema_comparer.assert_schema_equality(
          sorted_df.schema, expected_df.schema, ignore_nullable=True
      )
  
imports: from __future__ import annotations
  import pytest
  import chispa
  import quinn
  from pyspark.sql import DataFrame
  from pyspark.sql.types import StructType, StructField, StringType, IntegerType, ArrayType, MapType
  from quinn.transformations import flatten_struct, flatten_map, flatten_dataframe
  from tests.conftest import auto_inject_fixtures
label_desc: Use image node_id 5 for calling a global function with example usage: _test_sort_struct_flat(spark, sort_order) and returns: unsorted_df,  expected_df