Пример #1
0
def output(output_as_list):
    """Return the output that the list would produce"""
    if util.is_json(output_as_list[FIRST]):
        produced_output = SPACE.join(output_as_list)
    else:
        produced_output = NEWLINE.join(output_as_list)
    return produced_output
Пример #2
0
def test_json_detection_not_found():
    """Check if a not valid JSON string is not detected as JSON."""
    not_dictionary = "Command\nNot\nFound\n"
    is_valid_json = util.is_json(not_dictionary)
    assert is_valid_json is False
Пример #3
0
def test_json_detection_found():
    """Check if a valid JSON string is detected as JSON."""
    dictionary = {"a": "b"}
    json_string = json.dumps(dictionary)
    is_valid_json = util.is_json(json_string)
    assert is_valid_json is True