danish-dynaword / src /tests /test_duplicates.py
KennethEnevoldsen's picture
added tests for duplicates
ca7fb7b unverified
raw
history blame
766 Bytes
from pathlib import Path
from typing import cast
import pytest
from datasets import Dataset, load_dataset
from .conftest import DATASET_NAMES
@pytest.mark.skip("This currently fails for a number of datasets") # TODO: fix this
@pytest.mark.parametrize("dataset_name", DATASET_NAMES)
def test_no_within_data_duplicates(repo_path: Path, dataset_name: str):
ds = load_dataset(str(repo_path.resolve()), dataset_name, split="train")
ds = cast(Dataset, ds)
assert len(set(ds["text"])) == len(ds)
@pytest.mark.skip("This currently fails (see test above)") # TODO: fix this
def test_no_data_duplicates(repo_path: Path):
ds = load_dataset(str(repo_path.resolve()), split="train")
ds = cast(Dataset, ds)
assert len(set(ds["text"])) == len(ds)