示例#1
0
def test_count_matches_different_shapes():
    gold_ans = {'hello': [[1, 2, 3]]}
    taskrun = {'hello': [[1, 2], [3, 4]]}
    stat = gold.RightWrongCount()
    stat.compute(taskrun, gold_ans, 'hello')
    assert stat.value['right'] == 2
    assert stat.value['wrong'] == 1
示例#2
0
def test_count_matches_list_partially_correct():
    gold_ans = {'hello': [1, 2, 3]}
    taskrun = {'hello': [3, 2, 5, 6]}
    stat = gold.RightWrongCount()
    stat.compute(taskrun, gold_ans, 'hello')
    assert stat.value['right'] == 1
    assert stat.value['wrong'] == 2
示例#3
0
def test_count_matches_matrix():
    gold_ans = {'hello': [[1, 2], [3, 4]]}
    taskrun = {'hello': [[1, 3], [3, 4]]}
    stat = gold.RightWrongCount()
    stat.compute(taskrun, gold_ans, 'hello')
    assert stat.value['right'] == 3
    assert stat.value['wrong'] == 1
示例#4
0
def test_count_matches_list_all_wrong():
    gold_ans = {'hello': [1, 2, 3]}
    taskrun = {'hello': [3, 4, 5]}
    stat = gold.RightWrongCount()
    stat.compute(taskrun, gold_ans, 'hello')
    assert stat.value['right'] == 0
    assert stat.value['wrong'] == 3
示例#5
0
def test_count_matches_nested_wrong():
    gold_ans = {'hello': {'world': 1}}
    taskrun = {'hello': {'world': 2}}
    stat = gold.RightWrongCount()
    stat.compute(taskrun, gold_ans, 'hello.world')
    assert stat.value['right'] == 0
    assert stat.value['wrong'] == 1
示例#6
0
def test_count_matches_right():
    gold_ans = {'hello': 1}
    taskrun = {'hello': 1}
    stat = gold.RightWrongCount()
    stat.compute(taskrun, gold_ans, 'hello')
    assert stat.value['right'] == 1
    assert stat.value['wrong'] == 0
示例#7
0
def test_count_matches_error_no_ans():
    gold_ans = {'hello': {'goodbye': 1}}
    taskrun = {}
    stat = gold.RightWrongCount()
    stat.compute(taskrun, gold_ans, 'hello.goodbye')
    assert stat.value['right'] == 0
    assert stat.value['wrong'] == 1
示例#8
0
def test_array_match_wrong():
    stat = gold.RightWrongCount()
    stat.compare_lists = True
    gold_ans = {'hello': [1, 9, 3]}
    taskrun = {'hello': [1, 2, 3]}
    stat = gold.compute(stat, taskrun, gold_ans, 'hello')
    stat.right == 0
    stat.wrong == 1