code: def test_list():
      class WorkA(LightningWork):
          def __init__(self):
              super().__init__(port=1)
              self.c = 0
  
          def run(self):
              pass
  
      class A(LightningFlow):
          def __init__(self):
              super().__init__()
              self.list = List(WorkA(), WorkA(), WorkA(), WorkA())
  
          def run(self):
              pass
  
      flow = A()
  
      # TODO: these assertions are wrong, the works are getting added under "flows" instead of "works"
      # state
      assert (
          len(flow.state["structures"]["list"]["works"])
          == len(flow.list)
          == 4
      )
      assert list(flow.state["structures"]["list"]["works"].keys()) == [
          "0",
          "1",
          "2",
          "3",
      ]
      assert all(
          flow.state["structures"]["list"]["works"][str(i)]["vars"]
          == {
              "c": 0,
              "_url": "",
              "_future_url": "",
              "_port": 1,
              "_host": "127.0.0.1",
              "_paths": {},
              "_restarting": False,
              "_internal_ip": "",
              "_public_ip": "",
              "_display_name": "",
              "_cloud_compute": {
                  "type": "__cloud_compute__",
                  "name": "cpu-small",
                  "disk_size": 0,
                  "idle_timeout": None,
                  "mounts": None,
                  "shm_size": 0,
                  "_internal_id": "default",
                  "interruptible": False,
                  "colocation_group_id": None,
              },
          }
          for i in range(4)
      )
      assert all(
          flow.state["structures"]["list"]["works"][str(i)]["calls"]
          == {CacheCallsKeys.LATEST_CALL_HASH: None}
          for i in range(4)
      )
      assert all(
          flow.state["structures"]["list"]["works"][str(i)]["changes"]
          == {}
          for i in range(4)
      )
  
      # state_vars
      assert (
          len(flow.state_vars["structures"]["list"]["works"])
          == len(flow.list)
          == 4
      )
      assert list(
          flow.state_vars["structures"]["list"]["works"].keys()
      ) == ["0", "1", "2", "3"]
      assert all(
          flow.state_vars["structures"]["list"]["works"][str(i)]["vars"]
          == {
              "c": 0,
              "_url": "",
              "_future_url": "",
              "_port": 1,
              "_host": "127.0.0.1",
              "_paths": {},
              "_restarting": False,
              "_internal_ip": "",
              "_public_ip": "",
              "_display_name": "",
              "_cloud_compute": {
                  "type": "__cloud_compute__",
                  "name": "cpu-small",
                  "disk_size": 0,
                  "idle_timeout": None,
                  "mounts": None,
                  "shm_size": 0,
                  "_internal_id": "default",
                  "interruptible": False,
                  "colocation_group_id": None,
              },
          }
          for i in range(4)
      )
  
      # state_with_changes
      assert (
          len(flow.state_with_changes["structures"]["list"]["works"])
          == len(flow.list)
          == 4
      )
      assert list(
          flow.state_with_changes["structures"]["list"]["works"].keys()
      ) == ["0", "1", "2", "3"]
      assert all(
          flow.state_with_changes["structures"]["list"]["works"][
              str(i)
          ]["vars"]
          == {
              "c": 0,
              "_url": "",
              "_future_url": "",
              "_port": 1,
              "_host": "127.0.0.1",
              "_paths": {},
              "_restarting": False,
              "_internal_ip": "",
              "_public_ip": "",
              "_display_name": "",
              "_cloud_compute": {
                  "type": "__cloud_compute__",
                  "name": "cpu-small",
                  "disk_size": 0,
                  "idle_timeout": None,
                  "mounts": None,
                  "shm_size": 0,
                  "_internal_id": "default",
                  "interruptible": False,
                  "colocation_group_id": None,
              },
          }
          for i in range(4)
      )
      assert all(
          flow.state_with_changes["structures"]["list"]["works"][
              str(i)
          ]["calls"]
          == {CacheCallsKeys.LATEST_CALL_HASH: None}
          for i in range(4)
      )
      assert all(
          flow.state_with_changes["structures"]["list"]["works"][
              str(i)
          ]["changes"]
          == {}
          for i in range(4)
      )
  
      # set_state
      state = deepcopy(flow.state)
      state["structures"]["list"]["works"]["0"]["vars"]["c"] = 1
      flow.set_state(state)
      assert flow.list[0].c == 1
  
imports: import os
  from copy import deepcopy
  import pytest
  from lightning.app import LightningApp, LightningFlow, LightningWork
  from lightning.app.runners import MultiProcessRuntime
  from lightning.app.storage.payload import Payload
  from lightning.app.structures import Dict, List
  from lightning.app.testing.helpers import EmptyFlow
  from lightning.app.utilities.enum import CacheCallsKeys, WorkStageStatus
  from lightning.app.utilities.imports import _IS_WINDOWS
label_desc: Use image node_id 3 for calling a global function with example usage: test_list() without return types