docstr: Build a Trainer (no actual training), save it, and load it back in to check the type of Vocab restored
  
  TODO: This test may be a bit "eager" in that there are no other
  tests which check building, saving, & loading a pos trainer.
  Could add tests to test_trainer.py, for example
docstr_tok: ["Build","a","Trainer","(","no","actual","training",")",",","save","it",",","and","load","it","back","in","to","check","the","type","of","Vocab","restored","TODO",":","This","test","may","be","a","bit","``","eager","''","in","that","there","are","no","other","tests","which","check","building",",","saving",",","&","loading","a","pos","trainer",".","Could","add","tests","to","test_trainer.py",",","for","example"]
code: def check_reload(
      self, pt, shorthand, iterations, suffix, expected_vocab
  ):
      """
      Build a Trainer (no actual training), save it, and load it back in to check the type of Vocab restored
  
      TODO: This test may be a bit "eager" in that there are no other
      tests which check building, saving, & loading a pos trainer.
      Could add tests to test_trainer.py, for example
      """
      with tempfile.TemporaryDirectory(
          dir=TEST_WORKING_DIR
      ) as tmpdirname:
          args = tagger.parse_args(
              ["--batch_size", "1", "--shorthand", shorthand]
          )
          train_doc = build_doc(iterations, suffix)
          train_batch = Dataset(train_doc, args, pt, evaluation=False)
          vocab = train_batch.vocab
          assert isinstance(vocab["xpos"], expected_vocab)
  
          trainer = Trainer(
              args=args, vocab=vocab, pretrain=pt, device="cpu"
          )
  
          model_file = os.path.join(tmpdirname, "foo.pt")
          trainer.save(model_file)
  
          new_trainer = Trainer(model_file=model_file, pretrain=pt)
          assert isinstance(new_trainer.vocab["xpos"], expected_vocab)
  
imports: import pytest
  import logging
  import os
  import tempfile
  from stanza.models import tagger
  from stanza.models.common import pretrain
  from stanza.models.pos.data import Dataset
  from stanza.models.pos.trainer import Trainer
  from stanza.models.pos.vocab import WordVocab, XPOSVocab
  from stanza.models.pos.xpos_vocab_factory import xpos_vocab_factory
  from stanza.models.pos.xpos_vocab_utils import XPOSDescription, XPOSType, build_xpos_vocab, choose_simplest_factory
  from stanza.utils.conll import CoNLL
  from stanza.tests import TEST_WORKING_DIR
label_desc: Use image node_id 7 for calling the TestXPOSVocabFactory obj's underlying member method code with example usage: obj.check_reload(pt, shorthand, iterations, suffix, expected_vocab) without return types