예제 #1
0
파일: question.py 프로젝트: herrizd/Push_ME
 def _PrintQuestion(self):
   """Prints question and lists all choices."""
   choices_repr = [
       '[{}] {}'.format(index, msg)
       for index, msg in enumerate(self._choices, 1)
   ]
   choices_repr = [survey_util.Indent(content, 2) for content in choices_repr]
   choices_repr = '\n'.join(choices_repr)
   question_repr = survey_util.Indent(self._question, 1)
   log.Print('\n'.join([question_repr, choices_repr]))
예제 #2
0
 def _FormatQuestion(self, indexes):
     """Formats question to present to users."""
     choices_repr = [
         '[{}] {}'.format(index, msg)
         for index, msg in zip(indexes, self._choices)
     ]
     choices_repr = [
         survey_util.Indent(content, 2) for content in choices_repr
     ]
     choices_repr = '\n'.join(choices_repr)
     question_repr = survey_util.Indent(self._question, 1)
     return '\n'.join([question_repr, choices_repr])
예제 #3
0
    def testIndent(self):
        paragraph = 'line 1\nline 2\nline 3'
        result = survey_util.Indent(paragraph,
                                    indent_level=2,
                                    indent_size=3,
                                    indent_char='*')
        expected_result = """\
******line 1
******line 2
******line 3"""
        self.assertEqual(expected_result, result)
예제 #4
0
 def PrintQuestion(self):
     question = survey_util.Indent(self._question, 1)
     log.Print(question)