code: def test_registrable_functionality_works(self):
      # This function tests the basic `Registrable` functionality:
      #
      #   1. The decorator should add things to the list.
      #   2. The decorator should crash when adding a duplicate (unless exist_ok=True).
      #   3. If a default is given, it should show up first in the list.
      #
      # What we don't test here is that built-in items are registered correctly.  Those are
      # tested in the other tests below.
      #
      # We'll test this with the Tokenizer class, just to have a concrete class to use, and one
      # that has a default.
      base_class = Tokenizer
      assert "fake" not in base_class.list_available()
  
      @base_class.register("fake")
      class Fake(base_class):
          pass
  
      assert base_class.by_name("fake") == Fake
  
      default = base_class.default_implementation
      if default is not None:
          assert base_class.list_available()[0] == default
          base_class.default_implementation = "fake"
          assert base_class.list_available()[0] == "fake"
  
          with pytest.raises(ConfigurationError):
              base_class.default_implementation = "not present"
              base_class.list_available()
          base_class.default_implementation = default
  
      # Verify that registering under a name that already exists
      # causes a ConfigurationError.
      with pytest.raises(ConfigurationError):
  
          @base_class.register("fake")
          class FakeAlternate(base_class):
              pass
  
      # Registering under a name that already exists should overwrite
      # if exist_ok=True.
      @base_class.register("fake", exist_ok=True)  # noqa
      class FakeAlternate2(base_class):
          pass
  
      assert base_class.by_name("fake") == FakeAlternate2
  
      del Registrable._registry[base_class]["fake"]
  
imports: import inspect
  import os
  from typing import List
  import pytest
  from allennlp.common.checks import ConfigurationError
  from allennlp.common.registrable import Registrable
  from allennlp.common.testing import AllenNlpTestCase
  from allennlp.common.util import push_python_path
  from allennlp.data.dataset_readers.dataset_reader import DatasetReader
  from allennlp.data.token_indexers.token_indexer import TokenIndexer
  from allennlp.data.tokenizers.tokenizer import Tokenizer
  from allennlp.modules.text_field_embedders.text_field_embedder import TextFieldEmbedder
  from allennlp.modules.token_embedders.token_embedder import TokenEmbedder
  from allennlp.nn.regularizers.regularizer import Regularizer
label_desc: Use image node_id 1 for calling the TestRegistrable obj's underlying member method code with example usage: obj.test_registrable_functionality_works() without return types