code: def test_embedding_constructed_directly_with_pretrained_file(self):
      vocab = Vocabulary()
      vocab.add_token_to_namespace("word")
      vocab.add_token_to_namespace("word2")
      unicode_space = "\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0"
      vocab.add_token_to_namespace(unicode_space)
      embeddings_filename = str(self.TEST_DIR / "embeddings.gz")
      with gzip.open(embeddings_filename, "wb") as embeddings_file:
          embeddings_file.write("word 1.0 2.3 -1.0\n".encode("utf-8"))
          embeddings_file.write(
              f"{unicode_space} 3.4 3.3 5.0\n".encode("utf-8")
          )
  
      num_embeddings = vocab.get_vocab_size()
      embedding_layer = Embedding(
          embedding_dim=3,
          num_embeddings=num_embeddings,
          pretrained_file=embeddings_filename,
          vocab=vocab,
      )
      word_vector = embedding_layer.weight.data[
          vocab.get_token_index("word")
      ]
      assert numpy.allclose(
          word_vector.numpy(), numpy.array([1.0, 2.3, -1.0])
      )
      word_vector = embedding_layer.weight.data[
          vocab.get_token_index(unicode_space)
      ]
      assert numpy.allclose(
          word_vector.numpy(), numpy.array([3.4, 3.3, 5.0])
      )
      word_vector = embedding_layer.weight.data[
          vocab.get_token_index("word2")
      ]
      assert not numpy.allclose(
          word_vector.numpy(), numpy.array([1.0, 2.3, -1.0])
      )
  
imports: import gzip
  import warnings
  import numpy
  import pytest
  import torch
  from allennlp.common import Params
  from allennlp.common.checks import ConfigurationError
  from allennlp.common.testing import AllenNlpTestCase
  from allennlp.data import Vocabulary
  from allennlp.modules.token_embedders.embedding import _read_pretrained_embeddings_file, Embedding, EmbeddingsTextFile, format_embeddings_file_uri, parse_embeddings_file_uri
label_desc: Use image node_id 17 for calling the TestEmbedding obj's underlying member method code with example usage: obj.test_embedding_constructed_directly_with_pretrained_file() without return types