Files
Auto-GPT/agbenchmark/tests/basic_abilities/write_file/write_file_test.py
2023-06-27 13:26:28 -04:00

35 lines
971 B
Python

import pytest
from agbenchmark.challenges.define_task_types import ChallengeData
from agbenchmark.tests.basic_abilities.BasicChallenge import BasicChallenge
import os
data = ChallengeData.deserialize(
os.path.join(os.path.dirname(__file__), "w_file_data.json")
)
class TestWriteFile(BasicChallenge):
"""Testing if LLM can write to a file"""
@pytest.mark.parametrize(
"server_response",
[(data.task, data.mock_func)],
indirect=True,
)
@pytest.mark.parametrize(
"regression_data",
[data],
indirect=True,
)
@pytest.mark.depends(name="test_write_file")
def test_write_file(self, workspace):
files_contents = self.open_files(workspace, data.ground.files)
scores = []
for file_content in files_contents:
score = self.scoring(file_content, data.ground)
print("Your score is:", score)
scores.append(score)
assert 1 in scores