def _generate_test_data(self, name, hyps, refs):
    """Writes test data to temporary files.

    Args:
      name: str, used for making temp files unique across tests
      hyps: list of unicode strings serving as translation hypotheses
      refs: list of unicode strings serving as references

    Returns:
      hyp_file: path to temporary file containing the hypotheses
      refs_file: path to temporary file containing the references
    """
    assert len(hyps) == len(refs)
    hyp_file = os.path.join(tempfile.gettempdir(), "{}.hyps".format(name))
    refs_file = os.path.join(tempfile.gettempdir(), "{}.refs".format(name))
    for filename, items in zip([hyp_file, refs_file], [hyps, refs]):
      with (open(filename, "wb")
            if six.PY2 else open(filename, "w", encoding="utf-8")) as out:
        content = text_encoder.unicode_to_native(u"\n".join(items))
        out.write(content)
    return hyp_file, refs_file
Writes test data to temporary files.

    Args:
      name: str, used for making temp files unique across tests
      hyps: list of unicode strings serving as translation hypotheses
      refs: list of unicode strings serving as references

    Returns:
      hyp_file: path to temporary file containing the hypotheses
      refs_file: path to temporary file containing the references
    
tensor2tensor/utils/bleu_hook_test.py