mirror of
https://github.com/aljazceru/Auto-GPT.git
synced 2025-12-19 15:04:26 +01:00
35 lines
1.2 KiB
Python
35 lines
1.2 KiB
Python
import pytest
|
|
from agbenchmark.challenges.define_task_types import ChallengeData
|
|
from agbenchmark.Challenge import Challenge
|
|
from agbenchmark.tests.basic_abilities.BasicChallenge import BasicChallenge
|
|
import os
|
|
|
|
|
|
class TestReadFile(BasicChallenge):
|
|
"""Testing if LLM can read a file"""
|
|
|
|
@pytest.fixture(
|
|
scope="module", autouse=True
|
|
) # this is specific to setting up a file for the test, not all tests have this
|
|
def setup_module(self, workspace):
|
|
Challenge.write_to_file(
|
|
workspace, self.data.ground.files[0], "this is how we're doing"
|
|
)
|
|
|
|
def get_file_path(self) -> str: # all tests must implement this method
|
|
return os.path.join(os.path.dirname(__file__), "r_file_data.json")
|
|
|
|
@pytest.mark.depends(on=["basic_write_file"], name="basic_read_file")
|
|
def test_method(
|
|
self, workspace
|
|
): # run_test is a common name that all tests must implement
|
|
files_contents = self.open_files(workspace, self.data.ground.files)
|
|
|
|
scores = []
|
|
for file_content in files_contents:
|
|
score = self.scoring(file_content, self.data.ground)
|
|
print("Your score is:", score)
|
|
scores.append(score)
|
|
|
|
assert 1 in scores
|