@@ -54,21 +54,28 @@ def test_get_data_with_target(self):
5454 self .assertIn (y .dtype , [np .int32 , np .int64 ])
5555 self .assertEqual (X .shape , (898 , 38 ))
5656 X , y , attribute_names = self .dataset .get_data (
57- target = "class" , return_attribute_names = True )
57+ target = "class" ,
58+ return_attribute_names = True
59+ )
5860 self .assertEqual (len (attribute_names ), 38 )
5961 self .assertNotIn ("class" , attribute_names )
6062 self .assertEqual (y .shape , (898 , ))
6163
6264 def test_get_data_rowid_and_ignore_and_target (self ):
6365 self .dataset .ignore_attributes = ["condition" ]
6466 self .dataset .row_id_attribute = ["hardness" ]
65- X , y = self .dataset .get_data (target = "class" , include_row_id = False ,
66- include_ignore_attributes = False )
67+ X , y = self .dataset .get_data (
68+ target = "class" ,
69+ include_row_id = False ,
70+ include_ignore_attributes = False
71+ )
6772 self .assertEqual (X .dtype , np .float32 )
6873 self .assertIn (y .dtype , [np .int32 , np .int64 ])
6974 self .assertEqual (X .shape , (898 , 36 ))
7075 X , y , categorical = self .dataset .get_data (
71- target = "class" , return_categorical_indicator = True )
76+ target = "class" ,
77+ return_categorical_indicator = True ,
78+ )
7279 self .assertEqual (len (categorical ), 36 )
7380 self .assertListEqual (categorical , [True ] * 3 + [False ] + [True ] * 2 + [
7481 False ] + [True ] * 23 + [False ] * 3 + [True ] * 3 )
@@ -127,7 +134,9 @@ def test_get_sparse_dataset_with_target(self):
127134 self .assertIn (y .dtype , [np .int32 , np .int64 ])
128135 self .assertEqual (X .shape , (600 , 20000 ))
129136 X , y , attribute_names = self .sparse_dataset .get_data (
130- target = "class" , return_attribute_names = True )
137+ target = "class" ,
138+ return_attribute_names = True ,
139+ )
131140 self .assertTrue (sparse .issparse (X ))
132141 self .assertEqual (len (attribute_names ), 20000 )
133142 self .assertNotIn ("class" , attribute_names )
@@ -190,15 +199,34 @@ def test_get_sparse_dataset_rowid_and_ignore_and_target(self):
190199 self .sparse_dataset .ignore_attributes = ["V256" ]
191200 self .sparse_dataset .row_id_attribute = ["V512" ]
192201 X , y = self .sparse_dataset .get_data (
193- target = "class" , include_row_id = False ,
194- include_ignore_attributes = False )
202+ target = "class" ,
203+ include_row_id = False ,
204+ include_ignore_attributes = False ,
205+ )
195206 self .assertTrue (sparse .issparse (X ))
196207 self .assertEqual (X .dtype , np .float32 )
197208 self .assertIn (y .dtype , [np .int32 , np .int64 ])
198209 self .assertEqual (X .shape , (600 , 19998 ))
199210 X , y , categorical = self .sparse_dataset .get_data (
200- target = "class" , return_categorical_indicator = True )
211+ target = "class" ,
212+ return_categorical_indicator = True ,
213+ )
201214 self .assertTrue (sparse .issparse (X ))
202215 self .assertEqual (len (categorical ), 19998 )
203216 self .assertListEqual (categorical , [False ] * 19998 )
204217 self .assertEqual (y .shape , (600 , ))
218+
219+
220+ class OpenMLDatasetQualityTest (TestBase ):
221+ def test__check_qualities (self ):
222+ qualities = [{'oml:name' : 'a' , 'oml:value' : '0.5' }]
223+ qualities = openml .datasets .dataset ._check_qualities (qualities )
224+ self .assertEqual (qualities ['a' ], 0.5 )
225+
226+ qualities = [{'oml:name' : 'a' , 'oml:value' : 'null' }]
227+ qualities = openml .datasets .dataset ._check_qualities (qualities )
228+ self .assertNotEqual (qualities ['a' ], qualities ['a' ])
229+
230+ qualities = [{'oml:name' : 'a' , 'oml:value' : None }]
231+ qualities = openml .datasets .dataset ._check_qualities (qualities )
232+ self .assertNotEqual (qualities ['a' ], qualities ['a' ])
0 commit comments