Skip to content

Commit 07eab1a

Browse files
committed
added complicated testcase
1 parent d0e0638 commit 07eab1a

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

openml/datasets/dataset.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,11 @@ def __init__(self, dataset_id=None, name=None, version=None, description=None,
6464
self.url = url
6565
self.default_target_attribute = default_target_attribute
6666
self.row_id_attribute = row_id_attribute
67-
self.ignore_attributes = list(ignore_attribute) if ignore_attribute is not None else None # TODO: check
67+
self.ignore_attributes = None
68+
if isinstance(ignore_attribute, str):
69+
self.ignore_attributes = [ignore_attribute]
70+
elif isinstance(ignore_attribute, list):
71+
self.ignore_attributes = ignore_attribute
6872
self.version_label = version_label
6973
self.citation = citation
7074
self.tag = tag
@@ -311,6 +315,8 @@ def retrieve_class_labels(self, target_name='class'):
311315

312316
def get_features_by_type(self, data_type, exclude=None, exclude_ignore_attributes=True):
313317
assert data_type in OpenMLDataFeature.LEGAL_DATA_TYPES, "Illegal feature type requested"
318+
if self.ignore_attributes is not None:
319+
assert type(self.ignore_attributes) is list, "ignore_attributes should be a list"
314320
if exclude is not None:
315321
assert type(exclude) is list, "Exclude should be a list"
316322
assert all(isinstance(elem, str) for elem in exclude), "Exclude should be a list of strings"
@@ -319,7 +325,6 @@ def get_features_by_type(self, data_type, exclude=None, exclude_ignore_attribute
319325
to_exclude.extend(exclude)
320326
if exclude_ignore_attributes and self.ignore_attributes is not None:
321327
to_exclude.extend(self.ignore_attributes)
322-
print(to_exclude)
323328

324329
result = []
325330
offset = 0

tests/test_utils/test_conditionalimputer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def _do_test(self, dataset, X, nominal_indices, clf):
3434
return X_prime
3535

3636
def test_impute_indices(self):
37-
task_ids = [2, 24, 41, 42, 59]
37+
task_ids = [2, 24, 41, 42, 45, 59]
3838

3939
for task_id in task_ids:
4040
task = openml.tasks.get_task(task_id)
@@ -51,7 +51,7 @@ def test_impute_indices(self):
5151

5252

5353
def test_impute_smart(self):
54-
task_ids = [2, 24, 41, 42, 59]
54+
task_ids = [2, 24, 41, 42, 45, 59]
5555

5656
for task_id in task_ids:
5757
task = openml.tasks.get_task(task_id)

0 commit comments

Comments
 (0)