import tensorflow as tf

  def testProblemHparamsTargetOnlyModality(self):
    class TargetOnlyProblem(problem_module.Problem):

      def hparams(self, defaults, model_hparams):
        hp = defaults
        hp.modality = {"targets": modalities.SymbolModality}
        hp.vocab_size = {"targets": 3}

    problem = TargetOnlyProblem(False, False)
    p_hparams = problem.get_hparams()
    self.assertIsInstance(p_hparams.modality["targets"],
                          modalities.SymbolModality)
    self.assertLen(p_hparams.modality, 1)

if __name__ == "__main__":
  tf.test.main()
