Beispiel #1
0
def test_more_words_sentence():
    ok = False

    try:
        solution("aaa bbb ccc")
    except ValueError:
        ok = True
    except Exception:
        pass

    assert ok
Beispiel #2
0
def test_happy_path():
    word1 = "aaa"
    word2 = "bbb"

    input_data = f"{word1} {word2}"
    expected = f"!{word2} {word1}!"

    got = solution(input_data)
    assert expected == got
Beispiel #3
0
def handle_task_303(method: str, path: str, qs: str) -> ResponseT:
    status = "200 OK"
    content_type = "text/html"

    qsi = parse_qs(qs)

    template = read_template("task_303.html")

    sentence = qsi.get("sentence")

    if not sentence:
        result = ""
    else:
        sentence = sentence[0]
        result = task303.solution(sentence)

    payload = template.format(text=result)

    return status, content_type, payload
Beispiel #4
0
def test_single_word_sentence():
    result = solution("aaa")
    assert result == "!aaa!"
Beispiel #5
0
def test_empty_sentence():
    result = solution("")
    assert result == "!!"