code: def test_crazy_nested_union(self):
      class A(FromParams):
          def __init__(self, a: Union[int, List[int]]) -> None:
              self.a = a
  
      class B(FromParams):
          def __init__(self, b: Union[A, List[A]]) -> None:
              # Really you would want to be sure that `self.b` has a consistent type, but for
              # this test we'll ignore that.
              self.b = b
  
      class C(FromParams):
          def __init__(self, c: Union[A, B, Dict[str, A]]) -> None:
              # Really you would want to be sure that `self.c` has a consistent type, but for
              # this test we'll ignore that.
              self.c = c
  
      # This is a contrived, ugly example (why would you want to duplicate names in a nested
      # structure like this??), but it demonstrates a potential bug when dealing with mutatable
      # parameters.  If you're not careful about keeping the parameters un-mutated in two
      # separate places, you'll end up with a B, or with a dict that's missing the 'b' key.
      params = Params({"c": {"a": {"a": 3}, "b": {"a": [4, 5]}}})
      c = C.from_params(params)
      assert isinstance(c.c, dict)
      assert c.c["a"].a == 3
      assert c.c["b"].a == [4, 5]
  
imports: from typing import Dict, Iterable, List, Mapping, Optional, Set, Tuple, Union
  import pytest
  import torch
  from allennlp.common import Lazy, Params, Registrable
  from allennlp.common.from_params import FromParams, takes_arg, remove_optional, create_kwargs
  from allennlp.common.testing import AllenNlpTestCase
  from allennlp.data import DataLoader, DatasetReader, Tokenizer
  from allennlp.models import Model
  from allennlp.models.archival import load_archive
  from allennlp.common.checks import ConfigurationError
label_desc: Use image node_id 10 for calling the TestFromParams obj's underlying member method code with example usage: obj.test_crazy_nested_union() without return types