code: def testCalculateSplitsFingerprintSpanAndVersionWithSpan(self):
      # Test align of span and version numbers.
      span1_v1_split1 = os.path.join(
          self._input_base_path, "span01", "ver01", "split1", "data"
      )
      io_utils.write_string_file(span1_v1_split1, "testing11")
      span1_v1_split2 = os.path.join(
          self._input_base_path, "span01", "ver01", "split2", "data"
      )
      io_utils.write_string_file(span1_v1_split2, "testing12")
      span2_v1_split1 = os.path.join(
          self._input_base_path, "span02", "ver01", "split1", "data"
      )
      io_utils.write_string_file(span2_v1_split1, "testing21")
  
      # Test if error raised when span does not align.
      splits = [
          example_gen_pb2.Input.Split(
              name="s1", pattern="span{SPAN}/ver{VERSION}/split1/*"
          ),
          example_gen_pb2.Input.Split(
              name="s2", pattern="span{SPAN}/ver{VERSION}/split2/*"
          ),
      ]
      with self.assertRaisesRegex(
          ValueError, "Latest span should be the same for each split"
      ):
          utils.calculate_splits_fingerprint_span_and_version(
              self._input_base_path, splits
          )
  
      span2_v1_split2 = os.path.join(
          self._input_base_path, "span02", "ver01", "split2", "data"
      )
      io_utils.write_string_file(span2_v1_split2, "testing22")
      span2_v2_split1 = os.path.join(
          self._input_base_path, "span02", "ver02", "split1", "data"
      )
      io_utils.write_string_file(span2_v2_split1, "testing21")
  
      # Test if error raised when span aligns but version does not.
      splits = [
          example_gen_pb2.Input.Split(
              name="s1", pattern="span{SPAN}/ver{VERSION}/split1/*"
          ),
          example_gen_pb2.Input.Split(
              name="s2", pattern="span{SPAN}/ver{VERSION}/split2/*"
          ),
      ]
      with self.assertRaisesRegex(
          ValueError, "Latest version should be the same for each split"
      ):
          utils.calculate_splits_fingerprint_span_and_version(
              self._input_base_path, splits
          )
  
      span2_v2_split2 = os.path.join(
          self._input_base_path, "span02", "ver02", "split2", "data"
      )
      io_utils.write_string_file(span2_v2_split2, "testing22")
  
      # Test if latest span and version is selected when aligned for each split.
      splits = [
          example_gen_pb2.Input.Split(
              name="s1", pattern="span{SPAN}/ver{VERSION}/split1/*"
          ),
          example_gen_pb2.Input.Split(
              name="s2", pattern="span{SPAN}/ver{VERSION}/split2/*"
          ),
      ]
      (
          _,
          span,
          version,
      ) = utils.calculate_splits_fingerprint_span_and_version(
          self._input_base_path, splits
      )
      self.assertEqual(span, 2)
      self.assertEqual(version, 2)
      self.assertEqual(splits[0].pattern, "span02/ver02/split1/*")
      self.assertEqual(splits[1].pattern, "span02/ver02/split2/*")
  
imports: import os
  import re
  import tensorflow
  from tfx.components.example_gen import utils
  from tfx.dsl.io import fileio
  from tfx.orchestration import data_types
  from tfx.proto import example_gen_pb2
  from tfx.proto import range_config_pb2
  from tfx.utils import io_utils
  from tfx.utils import json_utils
label_desc: Use image node_id 30 for calling the UtilsTest obj's underlying member method code with example usage: obj.testCalculateSplitsFingerprintSpanAndVersionWithSpan() without return types