docstr: Tests that events are discarded after a restart is detected.
  
  If a step value is observed to be lower than what was previously seen,
  this should force a discard of all previous items with the same tag
  that are outdated.
  
  Only file versions < 2 use this out-of-order discard logic. Later versions
  discard events based on the step value of SessionLog.START.
docstr_tok: ["Tests","that","events","are","discarded","after","a","restart","is","detected",".","If","a","step","value","is","observed","to","be","lower","than","what","was","previously","seen",",","this","should","force","a","discard","of","all","previous","items","with","the","same","tag","that","are","outdated",".","Only","file","versions","<","2","use","this","out-of-order","discard","logic",".","Later","versions","discard","events","based","on","the","step","value","of","SessionLog.START","."]
code: def testExpiredDataDiscardedAfterRestartForFileVersionLessThan2(self):
      """Tests that events are discarded after a restart is detected.
  
      If a step value is observed to be lower than what was previously seen,
      this should force a discard of all previous items with the same tag
      that are outdated.
  
      Only file versions < 2 use this out-of-order discard logic. Later versions
      discard events based on the step value of SessionLog.START.
      """
      warnings = []
      self.stubs.Set(logger, "warning", warnings.append)
  
      gen = _EventGenerator(self)
      acc = self._make_accumulator(gen)
  
      gen.AddEvent(
          event_pb2.Event(
              wall_time=0, step=0, file_version="brain.Event:1"
          )
      )
      gen.AddScalarTensor("s1", wall_time=1, step=100, value=20)
      gen.AddScalarTensor("s1", wall_time=1, step=200, value=20)
      gen.AddScalarTensor("s1", wall_time=1, step=300, value=20)
      acc.Reload()
      ## Check that number of items are what they should be
      self.assertEqual(
          [x.step for x in acc.Tensors("s1")], [100, 200, 300]
      )
  
      gen.AddScalarTensor("s1", wall_time=1, step=101, value=20)
      gen.AddScalarTensor("s1", wall_time=1, step=201, value=20)
      gen.AddScalarTensor("s1", wall_time=1, step=301, value=20)
      acc.Reload()
      ## Check that we have discarded 200 and 300 from s1
      self.assertEqual(
          [x.step for x in acc.Tensors("s1")], [100, 101, 201, 301]
      )
  
imports: import os
  from unittest import mock
  import numpy
  import tensorflow
  from tensorboard import data_compat
  from tensorboard import dataclass_compat
  from tensorboard.backend.event_processing import plugin_event_accumulator
  from tensorboard.compat.proto import config_pb2
  from tensorboard.compat.proto import event_pb2
  from tensorboard.compat.proto import graph_pb2
  from tensorboard.compat.proto import meta_graph_pb2
  from tensorboard.compat.proto import summary_pb2
  from tensorboard.plugins.audio import metadata
  from tensorboard.plugins.audio import summary
  from tensorboard.plugins.graph import metadata
  from tensorboard.plugins.image import metadata
  from tensorboard.plugins.image import summary
  from tensorboard.plugins.scalar import metadata
  from tensorboard.plugins.scalar import summary
  from tensorboard.util import tb_logging
  from tensorboard.util import tensor_util
  from tensorboard.util import test_util
label_desc: Use image node_id 8 for calling the MockingEventAccumulatorTest obj's underlying member method code with example usage: obj.testExpiredDataDiscardedAfterRestartForFileVersionLessThan2() without return types