code: def test_match_unischema_fields_legacy_warning():
      TestSchema = Unischema(
          "TestSchema",
          [
              UnischemaField("int32", np.int32, (), None, False),
              UnischemaField("uint8", np.uint8, (), None, False),
              UnischemaField("uint16", np.uint16, (), None, False),
          ],
      )
  
      # Check that no warnings are shown if the legacy and the new way of filtering produce the same results.
      with pytest.warns(None) as unexpected_warnings:
          match_unischema_fields(TestSchema, ["uint8"])
      assert not unexpected_warnings
  
      # uint8 and uint16 would have been matched using the old method, but not the new one
      with pytest.warns(
          UserWarning,
          match=r"schema_fields behavior has changed.*uint16, uint8",
      ):
          assert match_unischema_fields(TestSchema, ["uint"]) == []
  
      # Now, all fields will be matched, but in different order (legacy vs current). Make sure we don't issue a warning.
      with pytest.warns(None) as unexpected_warnings:
          match_unischema_fields(
              TestSchema, ["int", "uint8", "uint16", "int32"]
          )
      assert not unexpected_warnings
  
imports: from __future__ import division
  from decimal import Decimal
  import numpy
  import pyarrow
  import pyarrow.parquet
  import pytest
  from pyspark import Row
  from pyspark.sql.types import StringType, IntegerType, DecimalType, ShortType, LongType
  from petastorm.codecs import ScalarCodec, NdarrayCodec
  from petastorm.unischema import Unischema, UnischemaField, dict_to_spark_row, insert_explicit_nulls, match_unischema_fields, _new_gt_255_compatible_namedtuple, _fullmatch
  from unittest import mock
label_desc: Use image node_id 22 for calling a global function with example usage: test_match_unischema_fields_legacy_warning() without return types