Esempio n. 1
0
def test_check_correct():
    result = te(
        sct=[{
            "range":
            "A1",
            "sct": [
                """
Ex().check_correct(
    check=has_equal_value(),
    diagnose=multi(check_operator(operator='-'))
)
"""
            ],
        }],
        student_data={
            "values": [["1"]],
            "formulas": [["=1"]]
        },
        solution_data={
            "values": [["1"]],
            "formulas": [["=3-2"]]
        },
    )

    assert result["correct"]
Esempio n. 2
0
def test_success_msg(success_msg, patt):
    result = te(sct=[],
                student_data={},
                solution_data={},
                success_msg=success_msg)
    assert result["correct"]
    assert result["message"] == patt
Esempio n. 3
0
def test_full(sct_range, sct, success):
    result = te(
        sct=[{
            "range": sct_range,
            "sct": [sct]
        }],
        student_data={
            "values": [["A", "B"]],
            "formulas": [["=A1", "=B1"]]
        },
        solution_data={
            "values": [["A", "A"]],
            "formulas": [["=A1", "=A1"]]
        },
    )
    assert result["correct"] == success
Esempio n. 4
0
def test_malformed(sct, student_data, solution_data):
    with pytest.raises(AssertionError):
        te(sct, student_data, solution_data)
Esempio n. 5
0
def test_empty():
    result = te(sct=[], student_data={}, solution_data={})
    assert result["correct"]