docstr: Tests whether a MultiAgentRLModule can be constructed from a config.
docstr_tok: ["Tests","whether","a","MultiAgentRLModule","can","be","constructed","from","a","config","."]
code: def test_from_config(self):
      """Tests whether a MultiAgentRLModule can be constructed from a config."""
      env_class = make_multi_agent("CartPole-v0")
      env = env_class({"num_agents": 2})
      module1 = SingleAgentRLModuleSpec(
          module_class=DiscreteBCTorchModule,
          observation_space=env.observation_space,
          action_space=env.action_space,
          model_config_dict={"fcnet_hiddens": [32]},
      )
  
      module2 = SingleAgentRLModuleSpec(
          module_class=DiscreteBCTorchModule,
          observation_space=env.observation_space,
          action_space=env.action_space,
          model_config_dict={"fcnet_hiddens": [32]},
      )
  
      config = MultiAgentRLModuleConfig(
          modules={"module1": module1, "module2": module2}
      )
      marl_module = MultiAgentRLModule(config)
  
      self.assertEqual(set(marl_module.keys()), {"module1", "module2"})
      self.assertIsInstance(
          marl_module["module1"], DiscreteBCTorchModule
      )
      self.assertIsInstance(
          marl_module["module2"], DiscreteBCTorchModule
      )
  
file_path: ray/rllib/core/rl_module/tests/test_marl_module.py
imports: import tempfile
  import unittest
  from ray.rllib.core.rl_module.rl_module import SingleAgentRLModuleSpec, RLModuleConfig
  from ray.rllib.core.rl_module.marl_module import MultiAgentRLModule, MultiAgentRLModuleConfig
  from ray.rllib.core.testing.torch.bc_module import DiscreteBCTorchModule
  from ray.rllib.core.testing.utils import DEFAULT_POLICY_ID
  from ray.rllib.env.multi_agent_env import make_multi_agent
  from ray.rllib.utils.test_utils import check
label_desc: Use image node_id 1 for calling the TestMARLModule obj's underlying member method code with example usage: obj.test_from_config() without return types