Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions tests/test_interleaved_web_documents.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import pytest
from datasets import load_dataset, get_dataset_config_names

@pytest.mark.integration_test
def test_interleaved_web_documents():
try:
get_dataset_config_names("HuggingFaceM4/InterleavedWebDocuments")
except Exception:
pytest.skip("Dataset HuggingFaceM4/InterleavedWebDocuments not yet available on the Hub")

dataset = load_dataset("HuggingFaceM4/InterleavedWebDocuments", split="train[:5]")
assert len(dataset) == 5
expected_features = {"url", "contents", "metadata"}
assert all(feature in dataset.features for feature in expected_features)
first = dataset[0]
assert isinstance(first["url"], str)
assert isinstance(first["contents"], list)
assert len(first["contents"]) > 0
assert isinstance(first["contents"][0], dict)
assert "type" in first["contents"][0]
assert "value" in first["contents"][0]