class_docstr: Test all storage backend
class_docstr_tok: ["Test","all","storage","backend"]
docstr: Change the status of a Trial requesting the wrong previous state.
code: def test_change_status_failed_update_because_of_was(self, storage):
      """Change the status of a Trial requesting the wrong previous state."""
  
      def check_status_change(new_status):
          with OrionState(
              experiments=[base_experiment],
              trials=generate_trials(),
              storage=storage,
          ) as cfg:
              trial = cfg.storage.get_trial(cfg.get_trial(1))
              assert (
                  trial is not None
              ), "Was not able to retrieve trial for test"
              assert trial.status != new_status
  
              if trial.status == new_status:
                  return
  
              with pytest.raises(FailedUpdate):
                  setup_storage().set_trial_status(
                      trial, status=new_status, was=new_status
                  )
  
      check_status_change("completed")
      check_status_change("broken")
      check_status_change("reserved")
      check_status_change("interrupted")
      check_status_change("suspended")
  
imports: import copy
  import datetime
  import logging
  import os
  import pickle
  import time
  import pytest
  import orion.core
  from orion.core.io.database import DuplicateKeyError
  from orion.core.io.database.pickleddb import PickledDB
  from orion.core.worker.trial import Trial
  from orion.storage.base import FailedUpdate, LockAcquisitionTimeout, LockedAlgorithmState, MissingArguments, setup_storage
  from orion.storage.legacy import Legacy
  from orion.storage.track import HAS_TRACK, REASON
  from orion.testing import OrionState, base_experiment
label_desc: Use image node_id 21 for calling the TestStorage obj's underlying member method code with example usage: obj.test_change_status_failed_update_because_of_was(storage) without return types