def _symbol_table_dict_roundtrip(self, use_fh=False):
    """Test full io pipeline on serializing relations.

    Very basic test that creates two symbol tables, serializes them,
    deserializes them, then compares them using methods in io.

    Args:
      use_fh: Boolean indicating usage of FileLike instead of Filename.
    """
    symbol_table_dict = _make_symbol_table_dict()
    if use_fh:
      with open(self.filename, 'wb') as fh:
        io.write_symbol_table_dict(fh, symbol_table_dict)
      with open(self.filename, 'rb') as fh:
        io_symbol_table_dict = io.read_symbol_table_dict(fh)
    else:
      io.write_symbol_table_dict(self.filename, symbol_table_dict)
      io_symbol_table_dict = io.read_symbol_table_dict(self.filename)
    for type_name in io_symbol_table_dict.keys():
      self.assertIn(type_name, symbol_table_dict)
    for type_name, t in symbol_table_dict.items():
      io_t = io_symbol_table_dict[type_name]
      self.assertEqual(t.get_unk_id(), io_t.get_unk_id())
      self.assertEqual(t.get_max_id(), io_t.get_max_id())
      self.assertEqual(t._vocab_size, io_t._vocab_size)
      t_symbols = t.get_symbols()
      io_t_symbols = io_t.get_symbols()
      self.assertEqual(t_symbols, io_t_symbols)
      for s in t_symbols:
        self.assertEqual(t.get_id(s), io_t.get_id(s))
Test full io pipeline on serializing relations.

    Very basic test that creates two symbol tables, serializes them,
    deserializes them, then compares them using methods in io.

    Args:
      use_fh: Boolean indicating usage of FileLike instead of Filename.
    
language/nql/nql/io_test.py