Beispiel #1
0
def output_text(dictionary_result) -> str:
    """Produce output in textual format."""
    # extract the details and form a string
    description = dictionary_result[constants.results.Description]
    outcome = dictionary_result[constants.results.Outcome]
    diagnostic = dictionary_result[constants.results.Diagnostic]
    # there is a diagnostic, so include it on the next line
    if diagnostic is not constants.markers.Nothing:
        submitted = (
            # display answer with a symbol not a boolean
            util.get_symbol_answer(outcome)
            + constants.markers.Space
            + description
            # SPACE
            + constants.markers.Space
            # NEWLINE
            + constants.markers.Newline
            # TAB
            + constants.markers.Tab
            # ARROW
            + constants.markers.Arrow
            # SPACE
            + constants.markers.Space
            + diagnostic
        )
    # there is no diagnostic, so do not include anything else
    else:
        submitted = (
            util.get_symbol_answer(outcome) + constants.markers.Space + description
        )
    return submitted
Beispiel #2
0
def form_single_output_line(check, outcome, diagnostic):
    """Produce a single line of output in a textual format"""
    # there is a diagnostic, so include it on the next line
    if diagnostic is not EMPTY_STRING:
        submitted = (util.get_symbol_answer(outcome) + SPACE + check + SPACE +
                     NEWLINE + TAB + ARROW + SPACE + diagnostic)
    # there is no diagnostic, so do not include anything else
    else:
        submitted = util.get_symbol_answer(outcome) + SPACE + check
    return submitted
Beispiel #3
0
def output_text(dictionary_result) -> str:
    """Produce output in textual format"""
    # extract the details and form a string
    check = dictionary_result[CHECK]
    outcome = dictionary_result[OUTCOME]
    diagnostic = dictionary_result[DIAGNOSTIC]
    # there is a diagnostic, so include it on the next line
    if diagnostic is not EMPTY_STRING:
        submitted = (util.get_symbol_answer(outcome) + SPACE + check + SPACE +
                     NEWLINE + TAB + ARROW + SPACE + diagnostic)
    # there is no diagnostic, so do not include anything else
    else:
        submitted = util.get_symbol_answer(outcome) + SPACE + check
    return submitted
Beispiel #4
0
def test_correct_false_symbol():
    """Check to ensure that false input returns heavy x-mark."""
    human_value = util.get_symbol_answer(False)
    assert human_value == "✘"
Beispiel #5
0
def test_correct_true_symbol():
    """Check to ensure that true input returns a heavy checkmark."""
    human_value = util.get_symbol_answer(True)
    assert human_value == "✔"