def testRemoveAll(self):
    """
    Test removeAll
    """
    checkpointMgr = ModelCheckpointMgr()

    # Should be empty at first
    ids = checkpointMgr.getModelIDs()
    self.assertSequenceEqual(ids, [])


    # Create some checkpoints using meta info
    expModelIDs = [uuid.uuid1().hex, uuid.uuid1().hex]
    expModelIDs.sort()
    for modelID in expModelIDs:
      checkpointMgr.define(modelID, definition={'a':1})

    ids = checkpointMgr.getModelIDs()
    self.assertItemsEqual(ids, expModelIDs)

    # Delete checkpoint store
    ModelCheckpointMgr.removeAll()

    ids = checkpointMgr.getModelIDs()
    self.assertSequenceEqual(ids, [])
  def testRemoveAll(self):
    """
    Test removeAll
    """
    checkpointMgr = ModelCheckpointMgr()

    # Should be empty at first
    ids = checkpointMgr.getModelIDs()
    self.assertSequenceEqual(ids, [])


    # Create some checkpoints using meta info
    expModelIDs = [uuid.uuid1().hex, uuid.uuid1().hex]
    expModelIDs.sort()
    for modelID in expModelIDs:
      checkpointMgr.define(modelID, definition={'a':1})

    ids = checkpointMgr.getModelIDs()
    self.assertItemsEqual(ids, expModelIDs)

    # Delete checkpoint store
    ModelCheckpointMgr.removeAll()

    ids = checkpointMgr.getModelIDs()
    self.assertSequenceEqual(ids, [])
  def testRemoveAndGetModelIDs(self):
    """
    Test getModelIDs and remove methods
    """
    checkpointMgr = ModelCheckpointMgr()

    # Should be empty at first
    ids = checkpointMgr.getModelIDs()
    self.assertListEqual(ids, [])


    # Create some checkpoints using meta info
    expModelIDs = [uuid.uuid1().hex, uuid.uuid1().hex]
    expModelIDs.sort()
    for modelID in expModelIDs:
      checkpointMgr.define(modelID, definition={'a':1})

    ids = checkpointMgr.getModelIDs()
    ids.sort()
    self.assertListEqual(ids, expModelIDs)


    # Delete one of them
    checkpointMgr.remove(expModelIDs[0])
    expModelIDs.remove(expModelIDs[0])

    ids = checkpointMgr.getModelIDs()
    ids.sort()
    self.assertListEqual(ids, expModelIDs)


    # Delete all of them
    for modelID in expModelIDs:
      checkpointMgr.remove(modelID)
    ids = checkpointMgr.getModelIDs()
    self.assertListEqual(ids, [])


    # If we try and delete a non-existing model, should get an exception
    self.assertRaises(ModelNotFound, checkpointMgr.remove, "IDx")
  def testRemoveAndGetModelIDs(self):
    """
    Test getModelIDs and remove methods
    """
    checkpointMgr = ModelCheckpointMgr()

    # Should be empty at first
    ids = checkpointMgr.getModelIDs()
    self.assertListEqual(ids, [])


    # Create some checkpoints using meta info
    expModelIDs = [uuid.uuid1().hex, uuid.uuid1().hex]
    expModelIDs.sort()
    for modelID in expModelIDs:
      checkpointMgr.define(modelID, definition={'a':1})

    ids = checkpointMgr.getModelIDs()
    ids.sort()
    self.assertListEqual(ids, expModelIDs)


    # Delete one of them
    checkpointMgr.remove(expModelIDs[0])
    expModelIDs.remove(expModelIDs[0])

    ids = checkpointMgr.getModelIDs()
    ids.sort()
    self.assertListEqual(ids, expModelIDs)


    # Delete all of them
    for modelID in expModelIDs:
      checkpointMgr.remove(modelID)
    ids = checkpointMgr.getModelIDs()
    self.assertListEqual(ids, [])


    # If we try and delete a non-existing model, should get an exception
    self.assertRaises(ModelNotFound, checkpointMgr.remove, "IDx")