code: def test_from_params_raises_error_on_wrong_parameter_name_in_optional_union(
      self,
  ):
      class NestedClass(FromParams):
          def __init__(self, varname: Optional[str] = None):
              self.varname = varname
  
      class WrapperClass(FromParams):
          def __init__(
              self,
              nested_class: Optional[Union[str, NestedClass]] = None,
          ):
              if isinstance(nested_class, str):
                  nested_class = NestedClass(varname=nested_class)
              self.nested_class = nested_class
  
      with pytest.raises(ConfigurationError):
          WrapperClass.from_params(
              params=Params(
                  {"nested_class": {"wrong_varname": "varstring"}}
              )
          )
  
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 33 for calling the TestFromParams obj's underlying member method code with example usage: obj.test_from_params_raises_error_on_wrong_parameter_name_in_optional_union() without return types