yearning
11 小时以前 3f96c9c6502243b06efd4bb34a189e72e3a5557c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import sys
from pathlib import Path
 
sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
 
from app.grading import grade_item, normalize_answer
 
 
def test_multi_choice_normalize():
    assert normalize_answer("A,B,C,D", 288) == "ABCD"
    assert normalize_answer("ABCD", 288) == "ABCD"
 
 
def test_single_grade():
    ok, sc = grade_item("A", "A", None, 272, 1.0)
    assert ok and sc == 1.0
    ok, sc = grade_item("B", "A", None, 272, 1.0)
    assert not ok and sc == 0.0