class_docstr: Test :meth:`orion.client.get_experiment`
class_docstr_tok: ["Test",":","meth",":","`","orion.client.get_experiment","`"]
docstr: Tests that experiment can be created in write mode
docstr_tok: ["Tests","that","experiment","can","be","created","in","write","mode"]
code: def test_read_write_mode(self, mock_database):
      """Tests that experiment can be created in write mode"""
      experiment = create_experiment(
          "a",
          space={"x": "uniform(0, 10)"},
          storage=mock_database.storage,
      )
      assert experiment.mode == "x"
  
      experiment = get_experiment(
          "a", 2, mode="r", storage=mock_database.storage
      )
      assert experiment.mode == "r"
  
      with pytest.raises(UnsupportedOperation) as exc:
          experiment.insert({"x": 0})
  
      assert exc.match(
          "ExperimentClient must have write rights to execute `insert()"
      )
  
      experiment = get_experiment(
          "a", 2, mode="w", storage=mock_database.storage
      )
      assert experiment.mode == "w"
  
      trial = experiment.insert({"x": 0})
  
      with pytest.raises(UnsupportedOperation) as exc:
          experiment.reserve(trial)
  
      assert exc.match(
          "ExperimentClient must have execution rights to execute `reserve()"
      )
  
imports: import copy
  import json
  from importlib import reload
  import pytest
  import orion.client
  import orion.client.cli
  import orion.core
  from orion.algo.random import Random
  from orion.client import get_experiment
  from orion.client.experiment import ExperimentClient
  from orion.core.io.database.ephemeraldb import EphemeralDB
  from orion.core.io.database.pickleddb import PickledDB
  from orion.core.utils.exceptions import BranchingEvent, NoConfigurationError, RaceCondition, UnsupportedOperation
  from orion.storage.base import setup_storage
  from orion.storage.legacy import Legacy
  from orion.testing import OrionState
label_desc: Use image node_id 4 for calling the TestGetExperiment obj's underlying member method code with example usage: obj.test_read_write_mode(mock_database) without return types