code: def test_lit_drive():
      with pytest.raises(
          Exception,
          match="Unknown protocol for the drive 'id' argument",
      ):
          Drive("invalid_drive_id")
  
      with pytest.raises(
          Exception,
          match="The id should be unique to identify your drive. Found `this_drive_id/something_else`.",
      ):
          Drive("lit://this_drive_id/something_else")
  
      drive = Drive("lit://this_drive_id")
      with pytest.raises(
          Exception,
          match="The component name needs to be known to put a path to the Drive.",
      ):
          drive.put(".")
  
      with pytest.raises(
          Exception,
          match="The component name needs to be known to delete a path to the Drive.",
      ):
          drive.delete(".")
  
      with open("a.txt", "w") as f:
          f.write("example")
  
      os.makedirs("checkpoints")
      with open("checkpoints/a.txt", "w") as f:
          f.write("example")
  
      drive = Drive("lit://drive_1", allow_duplicates=False)
      drive.component_name = "root.work_1"
      assert drive.list(".") == []
      drive.put("a.txt")
      assert drive.list(".") == ["a.txt"]
      drive.component_name = "root.work_2"
      with pytest.raises(
          Exception,
          match="The file a.txt can't be added as already found in the Drive.",
      ):
          drive.put("a.txt")
      drive.get("a.txt")
  
      drive = Drive("lit://drive_2", allow_duplicates=False)
      drive.component_name = "root.work_1"
      drive.put("checkpoints/a.txt")
      drive.component_name = "root.work_2"
      with pytest.raises(
          Exception,
          match="The file checkpoints/a.txt can't be added as already found in the Drive.",
      ):
          drive.put("checkpoints/a.txt")
  
      drive = Drive("lit://drive_3", allow_duplicates=False)
      drive.component_name = "root.work_1"
      drive.put("checkpoints/")
      drive.component_name = "root.work_2"
      with pytest.raises(
          Exception,
          match="The file checkpoints/a.txt can't be added as already found in the Drive.",
      ):
          drive.put("checkpoints/a.txt")
  
      drive = Drive("lit://drive_3", allow_duplicates=True)
      drive.component_name = "root.work_1"
      drive.put("checkpoints/")
      drive.component_name = "root.work_2"
      with pytest.raises(
          Exception,
          match="The file checkpoints/a.txt doesn't exists in the component_name space root.work_2.",
      ):
          drive.delete("checkpoints/a.txt")
      drive.put("checkpoints/a.txt")
      drive.delete("checkpoints/a.txt")
  
      drive = Drive("lit://drive_3", allow_duplicates=True)
      drive.component_name = "root.work_1"
      drive.put("checkpoints/")
      with pytest.raises(
          Exception, match="['root.work_1', 'root.work_2']"
      ):
          drive.get("checkpoints/")
      drive.get("checkpoints/a.txt", component_name="root.work_1")
      drive.get(
          "checkpoints/a.txt", component_name="root.work_1", timeout=1
      )
  
      with pytest.raises(FileNotFoundError):
          drive.get("checkpoints/b.txt", component_name="root.work_1")
      with pytest.raises(
          Exception,
          match="The following checkpoints/b.txt wasn't found in 1 seconds",
      ):
          drive.get(
              "checkpoints/b.txt",
              component_name="root.work_1",
              timeout=1,
          )
      drive.component_name = "root.work_2"
      drive.put("checkpoints/")
      drive.component_name = "root.work_3"
      with pytest.raises(
          Exception,
          match="We found several matching files created by multiples components",
      ):
          drive.get("checkpoints/a.txt")
      with pytest.raises(
          Exception,
          match="We found several matching files created by multiples components",
      ):
          drive.get("checkpoints/a.txt", timeout=1)
  
      drive = Drive("lit://drive_4", allow_duplicates=True)
      drive.component_name = "root.work_1"
      with pytest.raises(
          Exception,
          match="The following checkpoints/a.txt wasn't found in 1 seconds.",
      ):
          drive.get("checkpoints/a.txt", timeout=1)
  
      drive = Drive("lit://test", allow_duplicates=True)
      drive.component_name = "root.work1"
      drive.put("checkpoints")
      drive.get("checkpoints", overwrite=True)
      with pytest.raises(FileExistsError, match="overwrite=True"):
          drive.get("checkpoints")
  
      drive = Drive("lit://drive_5", allow_duplicates=True)
      drive.component_name = "root.work"
      _set_flow_context()
      with pytest.raises(
          Exception,
          match="The flow isn't allowed to put files into a Drive.",
      ):
          drive.put("a.txt")
      with pytest.raises(
          Exception,
          match="The flow isn't allowed to list files from a Drive.",
      ):
          drive.list("a.txt")
      with pytest.raises(
          Exception,
          match="The flow isn't allowed to get files from a Drive.",
      ):
          drive.get("a.txt")
  
      os.remove("checkpoints/a.txt")
      os.rmdir("checkpoints")
      os.remove("a.txt")
  
imports: import os
  import pathlib
  from copy import deepcopy
  from time import sleep
  import pytest
  from deepdiff import DeepDiff
  from lightning.app import LightningFlow, LightningWork
  from lightning.app.core.app import LightningApp
  from lightning.app.runners import MultiProcessRuntime
  from lightning.app.storage.drive import Drive, _maybe_create_drive
  from lightning.app.utilities.component import _set_flow_context
label_desc: Use image node_id 3 for calling a global function with example usage: test_lit_drive() without return types