Skip to content

Commit

Permalink
added unit test for model/benchmark retrieval method
Browse files Browse the repository at this point in the history
  • Loading branch information
shehadak committed Nov 10, 2023
1 parent 2397183 commit cc30b90
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions tests/test_submission/test_endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
""" the mock import has to be before importing endpoints so that the database is properly mocked """
from .mock_config import test_database

from brainscore_core.submission import database_models
from brainscore_core.submission import database_models, RunScoringEndpoint
from brainscore_core.submission.database import connect_db
from brainscore_core.submission.database_models import clear_schema
from brainscore_language.submission.endpoints import run_scoring
from brainscore_language.submission.endpoints import run_scoring, get_models_and_benchmarks


logger = logging.getLogger(__name__)
Expand All @@ -32,6 +32,16 @@ def teardown_method(self):
logger.info('Clean database')
clear_schema()

def test_get_models_benchmarks(self):
new_models = ['randomembedding-100']
new_benchmarks = ['Pereira2018.243sentences-linear']
args_dict = {'jenkins_id': 62, 'user_id': 1, 'model_type': 'artificialsubject',
'public': True, 'competition': 'None', 'new_models': new_models,
'new_benchmarks': new_benchmarks, 'specified_only': True}
model_ids, benchmark_ids = get_models_and_benchmarks(args_dict)
assert model_ids == new_models
assert benchmark_ids == new_benchmarks

def test_successful_run(self):
args_dict = {'jenkins_id': 62, 'user_id': 1, 'model_type': 'artificialsubject',
'public': True, 'competition': 'None', 'new_models': ['randomembedding-100'],
Expand Down

0 comments on commit cc30b90

Please sign in to comment.