danish-dynaword / tests /test_unique_ids.py
KennethEnevoldsen's picture
test: ensure datasets ids are unique
7b54871 unverified
raw
history blame
359 Bytes
from pathlib import Path
from typing import cast
from datasets import Dataset, load_dataset
def test_ensure_ids_are_unique():
repo = Path(__file__).parent.parent
name = str(repo.resolve()) # "danish-foundation-models/danish-gigaword-2"
ds = load_dataset(name, split="train")
ds = cast(Dataset, ds)
assert len(set(ds["id"])) == len(ds)