mirror of
https://github.com/open-thought/reasoning-gym.git
synced 2026-04-22 16:49:06 +00:00
test for parsing answer as python list
This commit is contained in:
parent
0db8012e88
commit
815b3c4ee5
2 changed files with 19 additions and 8 deletions
|
|
@ -106,3 +106,18 @@ def test_binary_matrix_answer():
|
|||
# Empty matrix
|
||||
matrix = [[0, 0, 0], [0, 0, 0], [0, 0, 0]]
|
||||
assert dataset._get_distances(matrix) == [[0, 0, 0], [0, 0, 0], [0, 0, 0]]
|
||||
|
||||
# String representation of answer
|
||||
answer = "0 0 0\n0 1 0\n1 2 1"
|
||||
entry = {"answer": "0 0 0\n0 1 0\n1 2 1"}
|
||||
assert dataset.score_answer(answer, entry) == 1.0
|
||||
|
||||
# Answer is a python list (partially correct answer)
|
||||
answer = "[[0, 0, 0], [0, 1, 0], [1, 2, 1]]"
|
||||
entry = {"answer": "0 0 0\n0 1 0\n1 2 1"}
|
||||
assert dataset.score_answer(answer, entry) == 0.5
|
||||
|
||||
# Answer is null
|
||||
answer = None
|
||||
entry = {"answer": "0 0 0\n0 1 0\n1 2 1"}
|
||||
assert dataset.score_answer(answer, entry) == 0.0
|
||||
Loading…
Add table
Add a link
Reference in a new issue