Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 6 additions & 14 deletions tests/test_tasks/test_split.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from pathlib import Path

import numpy as np
import pytest

from openml import OpenMLSplit
from openml.testing import TestBase
Expand Down Expand Up @@ -87,17 +88,8 @@ def test_get_split(self):
train_split, test_split = split.get(fold=5, repeat=2)
assert train_split.shape[0] == 808
assert test_split.shape[0] == 90
self.assertRaisesRegex( # noqa: PT027
ValueError,
"Repeat 10 not known",
split.get,
10,
2,
)
self.assertRaisesRegex( # noqa: PT027
ValueError,
"Fold 10 not known",
split.get,
2,
10,
)
with pytest.raises(ValueError, match="Repeat 10 not known"):
split.get(10, 2)

with pytest.raises(ValueError, match="Fold 10 not known"):
split.get(2, 10)
4 changes: 1 addition & 3 deletions tests/test_tasks/test_supervised_task.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# License: BSD 3-Clause
from __future__ import annotations

import unittest

import pandas as pd
import pytest

Expand All @@ -22,7 +20,7 @@ class OpenMLSupervisedTaskTest(OpenMLTaskTest):
@classmethod
def setUpClass(cls):
if cls is OpenMLSupervisedTaskTest:
raise unittest.SkipTest("Skip OpenMLSupervisedTaskTest tests, it's a base class")
pytest.skip("Skip OpenMLSupervisedTaskTest tests, it's a base class")
super().setUpClass()

def setUp(self, n_levels: int = 1): # noqa: ARG002
Expand Down
3 changes: 1 addition & 2 deletions tests/test_tasks/test_task.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# License: BSD 3-Clause
from __future__ import annotations

import unittest
from random import randint, shuffle

import pytest
Expand All @@ -26,7 +25,7 @@ class OpenMLTaskTest(TestBase):
@classmethod
def setUpClass(cls):
if cls is OpenMLTaskTest:
raise unittest.SkipTest("Skip OpenMLTaskTest tests, it's a base class")
pytest.skip("Skip OpenMLTaskTest tests, it's a base class")
super().setUpClass()

def setUp(self, n_levels: int = 1): # noqa: ARG002
Expand Down
13 changes: 4 additions & 9 deletions tests/test_tasks/test_task_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from __future__ import annotations

import os
import unittest
from unittest import mock

import pytest
Expand Down Expand Up @@ -40,12 +39,8 @@ def test__get_cached_task(self):

def test__get_cached_task_not_cached(self):
openml.config.set_root_cache_directory(self.static_cache_dir)
self.assertRaisesRegex( # noqa: PT027
OpenMLCacheException,
"Task file for tid 2 not cached",
openml.tasks.functions._get_cached_task,
2,
)
with pytest.raises(OpenMLCacheException, match="Task file for tid 2 not cached"):
openml.tasks.functions._get_cached_task(2)

@pytest.mark.test_server
def test__get_estimation_procedure_list(self):
Expand Down Expand Up @@ -141,8 +136,8 @@ def test__get_task(self):
openml.config.set_root_cache_directory(self.static_cache_dir)
openml.tasks.get_task(1882)

@unittest.skip(
"Please await outcome of discussion: https://github.com/openml/OpenML/issues/776",
@pytest.mark.skip(
reason="Please await outcome of discussion: https://github.com/openml/OpenML/issues/776",
)
@pytest.mark.production_server
def test__get_task_live(self):
Expand Down
19 changes: 5 additions & 14 deletions tests/test_tasks/test_task_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,8 @@ def test_get_train_and_test_split_indices(self):
assert train_indices[-1] == 681
assert test_indices[0] == 583
assert test_indices[-1] == 24
self.assertRaisesRegex( # noqa: PT027
ValueError,
"Fold 10 not known",
task.get_train_test_split_indices,
10,
0,
)
self.assertRaisesRegex( # noqa: PT027
ValueError,
"Repeat 10 not known",
task.get_train_test_split_indices,
0,
10,
)
with pytest.raises(ValueError, match="Fold 10 not known"):
task.get_train_test_split_indices(10, 0)

with pytest.raises(ValueError, match="Repeat 10 not known"):
task.get_train_test_split_indices(0, 10)
Loading