class_docstr: Test all storage backend
class_docstr_tok: ["Test","all","storage","backend"]
docstr: Test delete experiment trials matching a query
code: def test_delete_trials_with_query(self, storage):
      """Test delete experiment trials matching a query"""
      if storage and storage["type"] == "track":
          pytest.xfail("Track does not support deletion yet.")
  
      trials = generate_trials()
      trial_from_other_exp = copy.deepcopy(trials[0])
      trial_from_other_exp["experiment"] = "other"
      trials.append(trial_from_other_exp)
      with OrionState(
          experiments=[base_experiment], trials=trials, storage=storage
      ) as cfg:
          storage = cfg.storage
          experiment = cfg.get_experiment("default_name")
  
          # Make sure we have sufficient trials to test deletion
          status = trials[0]["status"]
          trials = storage.fetch_trials(experiment)
          trials_with_status = storage.fetch_trials_by_status(
              experiment, status
          )
          assert len(trials_with_status) > 0
          assert len(trials) > len(trials_with_status)
  
          # Test deletion
          count = storage.delete_trials(
              uid="default_name", where={"status": status}
          )
          assert count == len(trials_with_status)
          assert (
              storage.fetch_trials_by_status(experiment, status) == []
          )
          assert len(storage.fetch_trials(experiment)) == len(
              trials
          ) - len(trials_with_status)
  
          # Make sure trials from other experiments were not deleted
          assert len(storage.fetch_trials(uid="other")) == 1
  
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 14 for calling the TestStorage obj's underlying member method code with example usage: obj.test_delete_trials_with_query(storage) without return types