Skip to content

Commit 6261425

Browse files
committed
FIX minor unittest errors
1 parent b6fa253 commit 6261425

4 files changed

Lines changed: 11 additions & 9 deletions

File tree

openml/datasets/functions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ def _get_cached_dataset_arff(dataset_id):
106106
except (OSError, IOError):
107107
continue
108108

109-
raise OpenMLCacheException("ARFF file for dataset_id %d not "
109+
raise OpenMLCacheException("ARFF file for dataset id %d not "
110110
"cached" % dataset_id)
111111

112112

tests/datasets/test_datasets.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,19 +52,20 @@ def test_get_chached_dataset_description(self):
5252
def test_get_cached_dataset_description_not_cached(self):
5353
openml.config.set_cache_directory(self.static_cache_dir)
5454
self.assertRaisesRegexp(OpenMLCacheException, "Dataset description for "
55-
"did 3 not cached",
55+
"dataset id 3 not cached",
5656
openml.datasets.functions._get_cached_dataset_description,
5757
3)
5858

5959
def test_get_cached_dataset_arff(self):
6060
openml.config.set_cache_directory(self.static_cache_dir)
61-
description = openml.datasets.functions._get_cached_dataset_arff(did=2)
61+
description = openml.datasets.functions._get_cached_dataset_arff(
62+
dataset_id=2)
6263
self.assertIsInstance(description, str)
6364

6465
def test_get_cached_dataset_arff_not_cached(self):
6566
openml.config.set_cache_directory(self.static_cache_dir)
6667
self.assertRaisesRegexp(OpenMLCacheException, "ARFF file for "
67-
"did 3 not cached",
68+
"dataset id 3 not cached",
6869
openml.datasets.functions._get_cached_dataset_arff,
6970
3)
7071

@@ -197,12 +198,12 @@ def test_publish_dataset(self):
197198
name="anneal", version=1, description="test",
198199
format="ARFF", licence="public", default_target_attribute="class", data_file=file_path)
199200
dataset.publish()
200-
self.assertTrue(isinstance(dataset.dataset_id, int))
201+
self.assertIsInstance(dataset.dataset_id, int)
201202

202203
def test_upload_dataset_with_url(self):
203204
dataset = OpenMLDataset(
204205
name="UploadTestWithURL", version=1, description="test",
205206
format="ARFF",
206207
url="http://expdb.cs.kuleuven.be/expdb/data/uci/nominal/iris.arff")
207208
dataset.publish()
208-
self.assertTrue(isinstance(dataset.dataset_id, int))
209+
self.assertIsInstance(dataset.dataset_id, int)

tests/flows/test_flow.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ def check_flow(flow):
2121
def test_upload_flow(self):
2222
flow = openml.OpenMLFlow(model=DummyClassifier(), description="test description")
2323
flow.publish()
24-
self.assertTrue(isinstance(flow.flow_id, int))
24+
self.assertIsInstance(flow.flow_id, int)

tests/runs/test_runs.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ def test_run_iris(self):
88
task = openml.tasks.get_task(10107)
99
clf = LogisticRegression()
1010
run = openml.runs.run_task(task, clf)
11-
return_code, return_value = run.publish()
12-
self.assertTrue(isinstance(run.dataset_id, int))
11+
run_ = run.publish()
12+
self.assertEqual(run_, run)
13+
self.assertIsInstance(run.dataset_id, int)
1314

1415
def test_get_run(self):
1516
run = openml.runs.get_run(473350)

0 commit comments

Comments
 (0)