File size: 766 Bytes
ca7fb7b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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)