コード例 #1
0
ファイル: test_gold.py プロジェクト: bloomberg/pybossa
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
ファイル: test_gold.py プロジェクト: bloomberg/pybossa
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
ファイル: test_gold.py プロジェクト: bloomberg/pybossa
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
ファイル: test_gold.py プロジェクト: bloomberg/pybossa
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
ファイル: test_gold.py プロジェクト: bloomberg/pybossa
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
ファイル: test_gold.py プロジェクト: bloomberg/pybossa
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
ファイル: test_gold.py プロジェクト: bloomberg/pybossa
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
ファイル: test_gold.py プロジェクト: bloomberg/pybossa
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