Ejemplo n.º 1
0
def test_new_answer_type_listed():
    q = Question(answer_type="TEST")
    with pytest.raises(RuntimeError):
        q.is_answer_valid(answer="foo")
Ejemplo n.º 2
0
def test_answer_type_annotation_schema(answer, answer_type):
    q = Question(answer_type=answer_type)
    assert q.is_answer_valid(answer=answer) is True
Ejemplo n.º 3
0
def test_answer_type_annotation_header_schema_fails(answer,
                                                    answer_type: str = "HEAD"):
    q = Question(answer_type=answer_type)
    assert not q.is_answer_valid(answer=answer)
def test_answer_type_allows_null(answer_type, allow_null):
    q = Question(answer_type=answer_type)
    assert q.is_answer_valid(answer=None) == allow_null