Ejemplo n.º 1
0
def __get_text_for_justification_or_reaction_bubble(
        stmt_or_arg: Union[Statement, Argument], is_supportive, db_user, step,
        history, _tn):
    """
    Returns text for an justification or reaction bubble of the user

    :param stmt_or_arg: Argument.uid / Statement.uid
    :param is_supportive: Boolean
    :param db_user: User
    :param step: String
    :param history: String
    :param _tn: Translator
    :return: String
    """
    if isinstance(stmt_or_arg, Argument):
        splitted_history = get_splitted_history(history)
        bubbles = get_bubble_from_reaction_step(step,
                                                db_user,
                                                _tn.get_lang(),
                                                splitted_history,
                                                '',
                                                color_steps=True)
        text = bubbles[0]['message'] if bubbles else ''
    else:
        text, tmp = get_user_bubble_text_for_justify_statement(
            stmt_or_arg.uid, db_user, is_supportive, _tn)
        text = pretty_print_options(text)

    return text
Ejemplo n.º 2
0
 def test_pretty_print_options(self):
     self.assertEqual(lib.pretty_print_options('hallo'), 'Hallo.')
     self.assertEqual(lib.pretty_print_options('<bla>hallo'), '<bla>Hallo.')
     self.assertEqual(lib.pretty_print_options('<bla>hallo</bla>'), '<bla>Hallo.</bla>')
Ejemplo n.º 3
0
 def test_pretty_print_options(self):
     self.assertTrue('Hallo.', lib.pretty_print_options('hallo'))
     self.assertTrue('Hallo.', lib.pretty_print_options('<bla>hallo'))
     self.assertTrue('Hallo.', lib.pretty_print_options('<bla>hallo</bla>'))