code: def test_transformer_text_field_from_huggingface(return_tensors):
      tokenizer = get_tokenizer("bert-base-cased")
  
      batch = Batch(
          [
              Instance(
                  {
                      "text": TransformerTextField(
                          **tokenizer(
                              text, return_tensors=return_tensors
                          )
                      )
                  }
              )
              for text in [
                  "Hello, World!",
                  "The fox jumped over the fence",
                  "Humpty dumpty sat on a wall",
              ]
          ]
      )
      tensors = batch.as_tensor_dict(batch.get_padding_lengths())
      assert tensors["text"]["input_ids"].shape == (3, 11)
  
file_path: allennlp/tests/data/fields/transformer_text_field_test.py
imports: import torch
  import pytest
  from allennlp.common.cached_transformers import get_tokenizer
  from allennlp.data import Batch, Instance
  from allennlp.data.fields import TransformerTextField
label_desc: Use image node_id 4 for calling a global function with example usage: test_transformer_text_field_from_huggingface(return_tensors) without return types