code: def test_extras(self):
      from allennlp.common.registrable import Registrable
  
      class A(Registrable):
          pass
  
      @A.register("b")
      class B(A):
          def __init__(self, size: int, name: str) -> None:
              self.size = size
              self.name = name
  
      @A.register("c")
      class C(A):
          def __init__(self, size: int, name: str) -> None:
              self.size = size
              self.name = name
  
          # custom from params
          @classmethod
          def from_params(cls, params: Params, size: int, **extras) -> "C":  # type: ignore
              name = params.pop("name")
              return cls(size=size, name=name)
  
      # Check that extras get passed, even though A doesn't need them.
      params = Params({"type": "b", "size": 10})
      b = A.from_params(params, name="extra")
  
      assert b.name == "extra"
      assert b.size == 10
  
      # Check that extra extras don't get passed.
      params = Params({"type": "b", "size": 10})
      b = A.from_params(params, name="extra", unwanted=True)
  
      assert b.name == "extra"
      assert b.size == 10
  
      # Now the same with a custom from_params.
      params = Params({"type": "c", "name": "extra_c"})
      c = A.from_params(params, size=20)
      assert c.name == "extra_c"
      assert c.size == 20
  
      # Check that extra extras don't get passed.
      params = Params({"type": "c", "name": "extra_c"})
      c = A.from_params(params, size=20, unwanted=True)
  
      assert c.name == "extra_c"
      assert c.size == 20
  
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 6 for calling the TestFromParams obj's underlying member method code with example usage: obj.test_extras() and returns: cls