code: def test_embeddings_text_file_num_tokens(self):
      test_filename = str(self.TEST_DIR / "temp_embeddings.vec")
  
      def check_num_tokens(first_line, expected_num_tokens):
          with open(test_filename, "w") as f:
              f.write(first_line)
          with EmbeddingsTextFile(test_filename) as f:
              assert (
                  f.num_tokens == expected_num_tokens
              ), f"Wrong num tokens for line: {first_line}"
  
      valid_header_lines = ["1000000 300", "300 1000000", "1000000"]
      for line in valid_header_lines:
          check_num_tokens(line, expected_num_tokens=1_000_000)
  
      not_header_lines = [
          "hello 1",
          "hello 1 2",
          "111 222 333",
          "111 222 hello",
      ]
      for line in not_header_lines:
          check_num_tokens(line, expected_num_tokens=None)
  
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 9 for calling the TestEmbedding obj's underlying member method code with example usage: obj.test_embeddings_text_file_num_tokens() without return types