Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
Samoed committed Nov 13, 2024
1 parent 169a834 commit ddd04ab
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"test": {
"average_sentence1_length": 78.59148351648352,
"average_sentence2_length": 78.59148351648352,
"num_samples": 3640,
"number_of_characters": 572146,
"hf_subset_descriptive_stats": {
"kat_Geor-eng_Latn": {
"average_sentence1_length": 76.06593406593407,
"average_sentence2_length": 81.11703296703297,
"num_samples": 1820,
"number_of_characters": 286073
},
"eng_Latn-kat_Geor": {
"average_sentence1_length": 81.11703296703297,
"average_sentence2_length": 76.06593406593407,
"num_samples": 1820,
"number_of_characters": 286073
}
}
}
}
23 changes: 13 additions & 10 deletions tests/test_TaskMetadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import pytest

from mteb import AbsTask
from mteb.abstasks.TaskMetadata import TaskMetadata
from mteb.overview import get_tasks

Expand Down Expand Up @@ -525,11 +526,11 @@ def test_disallow_trust_remote_code_in_new_datasets():
), f"Dataset {task.metadata.name} should not trust remote code"


def test_empy_descriptive_stat_in_new_datasets():
@pytest.mark.parametrize("task", get_tasks())
def test_empy_descriptive_stat_in_new_datasets(task: AbsTask):
# DON'T ADD NEW DATASETS TO THIS LIST
# THIS IS ONLY INTENDED FOR HISTORIC DATASETS
exceptions = [
"TbilisiCityHallBitextMining",
"BibleNLPBitextMining",
"BUCC.v2",
"DiaBlaBitextMining",
Expand Down Expand Up @@ -1085,13 +1086,15 @@ def test_empy_descriptive_stat_in_new_datasets():
]

assert (
553 == len(exceptions)
552 == len(exceptions)
), "The number of exceptions has changed. Please do not add new datasets to this list."

for task in get_tasks():
if task.metadata.name.startswith("Mock"):
continue
if task.metadata.descriptive_stats is None:
assert (
task.metadata.name in exceptions
), f"Dataset {task.metadata.name} should have descriptive stats. You can add metadata to your task by running `YorTask.calculate_metadata_metrics()`"
if task.metadata.name.startswith("Mock"):
return

if task.metadata.name in exceptions:
assert task.metadata.descriptive_stats is None, f"Dataset {task.metadata.name} should not have descriptive stats"
else:
assert (
task.metadata.descriptive_stats is not None
), f"Dataset {task.metadata.name} should have descriptive stats. You can add metadata to your task by running `YorTask().calculate_metadata_metrics()`"

0 comments on commit ddd04ab

Please sign in to comment.