File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change 1
1
import unittest
2
2
3
- from datasets import Dataset
4
-
3
+ import datasets
4
+ import pandas as pd
5
+ import warnings
5
6
6
7
class TestHuggingFaceDatasets (unittest .TestCase ):
7
8
@@ -10,7 +11,13 @@ def some_func(batch):
10
11
batch ['label' ] = 'foo'
11
12
return batch
12
13
13
- df = Dataset .from_dict ({'text' : ['Kaggle rocks!' ]})
14
+ df = datasets . Dataset .from_dict ({'text' : ['Kaggle rocks!' ]})
14
15
mapped_df = df .map (some_func )
15
16
16
- self .assertEqual ('foo' , mapped_df [0 ]['label' ])
17
+ self .assertEqual ('foo' , mapped_df [0 ]['label' ])
18
+
19
+ def test_load_dataset (self ):
20
+ warnings .simplefilter (action = 'ignore' , category = FutureWarning )
21
+ dataset = datasets .load_dataset ("csv" , data_files = "/input/tests/data/train.csv" )
22
+ full_data = pd .DataFrame (dataset ['train' ])
23
+ self .assertFalse (full_data .empty )
You can’t perform that action at this time.
0 commit comments