-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathconftest.py
More file actions
45 lines (27 loc) · 1.07 KB
/
conftest.py
File metadata and controls
45 lines (27 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import importlib.resources as ires
from pathlib import Path
from typing import Literal
import pytest
from autointent import Dataset
from autointent.utils import load_search_space
def setup_environment() -> Path:
return ires.files("tests").joinpath("logs")
def get_dataset_path():
return ires.files("tests.assets.data").joinpath("clinc_subset.json")
@pytest.fixture
def dataset():
return Dataset.from_json(get_dataset_path())
@pytest.fixture
def dataset_unsplitted():
path = ires.files("tests.assets.data").joinpath("clinc_subset_unsplitted.json")
return Dataset.from_json(path)
@pytest.fixture
def dataset_no_oos():
path = ires.files("tests.assets.data").joinpath("clinc_no_oos.json")
return Dataset.from_json(path)
TaskType = Literal["multiclass", "multilabel", "description", "optuna", "light", "regex"]
def get_search_space_path(task_type: TaskType):
return ires.files("tests.assets.configs").joinpath(f"{task_type}.yaml")
def get_search_space(task_type: TaskType):
path = get_search_space_path(task_type)
return load_search_space(path)