Skip to content

Commit

Permalink
added a test to test_loaders, since catalog does not participate in c…
Browse files Browse the repository at this point in the history
…overage

Signed-off-by: dafnapension <dafnashein@yahoo.com>
  • Loading branch information
dafnapension committed Feb 28, 2024
1 parent 83809c8 commit a6becb2
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/library/test_loaders.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,3 +145,22 @@ def test_load_from_HF_split(self):
"hide new secretions from the parental units ",
)
assert list(dataset.keys()) == ["train"], f"Unexpected fold {dataset.keys()}"

def test_load_from_HF_filter(self):
loader = LoadHF(
path="CohereForAI/aya_evaluation_suite",
name="aya_human_annotated",
filtering_lambda='lambda instance: instance["language"]=="eng"',
)
ms = loader.stream_dataset()
dataset = ms.to_dataset()
self.assertEqual(
list(dataset.keys()), ["test"]
) # that HF dataset only has the 'test' split
self.assertEqual(dataset["test"][0]["language"], "eng")
ms = loader.load_dataset()
dataset = ms.to_dataset()
self.assertEqual(
list(dataset.keys()), ["test"]
) # that HF dataset only has the 'test' split
self.assertEqual(dataset["test"][0]["language"], "eng")

0 comments on commit a6becb2

Please sign in to comment.