code: def testLatestSpan_SkipLastN(self):
      artifacts = self._get_artifacts_for_rolling_range_tests()
      a10, a20, a31, a30, a71, a82 = artifacts
  
      actual = self._latest_span(artifacts)
      self.assertEqual(actual, [a82])
  
      actual = self._latest_span(artifacts, skip_last_n=1)
      self.assertEqual(actual, [a71])
  
      actual = self._latest_span(artifacts, skip_last_n=2)
      self.assertEqual(actual, [a31])
  
      # Tests version conflicts when keep_all_versions=False
      actual = self._latest_span(artifacts, skip_last_n=2, n=2)
      self.assertEqual(actual, [a20, a31])
  
      # Tests version conflicts when keep_all_versions=True. Note that 3 artifacts
      # are returned even when n=2, because n is the number of spans, NOT the
      # number of artifacts to return.
      actual = self._latest_span(
          artifacts, skip_last_n=2, n=2, keep_all_versions=True
      )
      self.assertEqual(actual, [a20, a30, a31])
  
      actual = self._latest_span(
          artifacts, skip_last_n=2, n=3, keep_all_versions=True
      )
      self.assertEqual(actual, [a10, a20, a30, a31])
  
      actual = self._latest_span(artifacts, skip_last_n=3, n=2)
      self.assertEqual(actual, [a10, a20])
  
      # skip_last_n=6 is larger than the number of artifacts with unique spans
      # available.
      actual = self._latest_span(artifacts, skip_last_n=6)
      self.assertEqual(actual, [])
  
      actual = self._latest_span(artifacts, skip_last_n=6, n=6)
      self.assertEqual(actual, [])
  
      # Test skip_last_n when n < 0.
      actual = self._latest_span(artifacts, n=-1, skip_last_n=2)
      self.assertEqual(actual, [a10, a20, a31])
  
      actual = self._latest_span(
          artifacts, n=-1, skip_last_n=2, keep_all_versions=True
      )
      self.assertEqual(actual, [a10, a20, a30, a31])
  
imports: from typing import Sequence
  import tensorflow
  from tfx import types
  from tfx.dsl.input_resolution.ops import ops
  from tfx.dsl.input_resolution.ops import test_utils
  from tfx.types import artifact
label_desc: Use image node_id 7 for calling the LatestSpanOpTest obj's underlying member method code with example usage: obj.testLatestSpan_SkipLastN() without return types