from tensorflow.python.platform import gfile


      # Exercise the second helper.

      # Adding s2 again (old s2 is removed first, then new s2 appended)
      s2 = save2.save(sess, os.path.join(save_dir, "s2"))
      self.assertEqual([s3, s2], save2.last_checkpoints)
      # Created by the first helper.
      self.assertTrue(gfile.Exists(s1))
      self.assertTrue(gfile.Exists(save._MetaGraphFilename(s1)))
      # Deleted by the first helper.
      self.assertFalse(gfile.Exists(s3))
      self.assertFalse(gfile.Exists(save._MetaGraphFilename(s3)))
      self.assertTrue(gfile.Exists(s2))
      self.assertTrue(gfile.Exists(save._MetaGraphFilename(s2)))

      # Adding s1 (s3 should now be deleted as oldest in list)
      s1 = save2.save(sess, os.path.join(save_dir, "s1"))
      self.assertEqual([s2, s1], save2.last_checkpoints)
      self.assertFalse(gfile.Exists(s3))
      self.assertFalse(gfile.Exists(save._MetaGraphFilename(s3)))
      self.assertTrue(gfile.Exists(s2))
      self.assertTrue(gfile.Exists(save._MetaGraphFilename(s2)))
      self.assertTrue(gfile.Exists(s1))
      self.assertTrue(gfile.Exists(save._MetaGraphFilename(s1)))
