-
Notifications
You must be signed in to change notification settings - Fork 4
/
conftest.py
46 lines (31 loc) · 1.03 KB
/
conftest.py
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
46
import pytest, tempfile
from pathlib import Path
import numpy as np
from baynet.structure import DAG
TEST_MODELSTRING = "[A][B|C:D][C|D][D]"
REVERSED_MODELSTRING = "[A][B][C|B][D|B:C]"
@pytest.fixture(scope="function")
def test_dag() -> DAG:
return DAG.from_modelstring(TEST_MODELSTRING)
@pytest.fixture(scope="function")
def reversed_dag() -> DAG:
return DAG.from_modelstring(REVERSED_MODELSTRING)
@pytest.fixture(scope="function")
def partial_dag() -> DAG:
return DAG.from_modelstring("[A][B|C:D][C][D]")
@pytest.fixture(scope="function")
def empty_dag() -> DAG:
return DAG.from_amat(np.zeros((4, 4)), list("ABCD"))
@pytest.fixture(scope="session")
def test_modelstring() -> str:
return TEST_MODELSTRING
@pytest.fixture(scope="session")
def reversed_modelstring() -> str:
return REVERSED_MODELSTRING
@pytest.fixture(scope="function")
def temp_out() -> Path:
"""
Create temporary directory for storing test outputs.
"""
with tempfile.TemporaryDirectory() as tmpdir:
yield Path(tmpdir).resolve()