Skip to content

Commit

Permalink
show the point also for the case of split=None
Browse files Browse the repository at this point in the history
Signed-off-by: dafnapension <[email protected]>
  • Loading branch information
dafnapension committed Feb 11, 2025
1 parent 6dcaf18 commit 06d6513
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions tests/library/test_loaders.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from unittest.mock import patch

import pandas as pd
from datasets import IterableDataset
from datasets import IterableDataset, IterableDatasetDict
from unitxt.error_utils import UnitxtError
from unitxt.loaders import (
LoadCSV,
Expand Down Expand Up @@ -242,7 +242,15 @@ def test_load_HF_lazily(self):
# now we try to touch the arriving dataset, which in current main is only done by the split generator when yielding
with self.assertRaises(Exception):
next(iter(dataset))

# the same goes when split=None:
dataset = lazy_loader.load_dataset(split=None)
assert isinstance(dataset, IterableDatasetDict)
# we just assured that load_dataset completed OK, not noticing anything bad.
# now we try to touch the samples in the arriving dataset, which in current main is only done by the split generator when yielding
with self.assertRaises(Exception):
for k in dataset.keys():
next(iter(dataset[k]))
break

def test_load_from_HF_split(self):
loader = LoadHF(path="sst2", split="train")
Expand Down

0 comments on commit 06d6513

Please sign in to comment.