MCPcopy Create free account
hub / github.com/Kaggle/docker-python / TestHuggingFaceDatasets

Class TestHuggingFaceDatasets

tests/test_hf_datasets.py:6–21  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4import pandas as pd
5
6class TestHuggingFaceDatasets(unittest.TestCase):
7
8 def test_map(self):
9 def some_func(batch):
10 batch['label'] = 'foo'
11 return batch
12
13 df = datasets.Dataset.from_dict({'text': ['Kaggle rocks!']})
14 mapped_df = df.map(some_func)
15
16 self.assertEqual('foo', mapped_df[0]['label'])
17
18 def test_load_dataset(self):
19 dataset = datasets.load_dataset("csv", data_files="/input/tests/data/train.csv")
20 full_data = pd.DataFrame(dataset['train'])
21 self.assertFalse(full_data.empty)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected