-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconftest.py
More file actions
59 lines (46 loc) · 1.45 KB
/
conftest.py
File metadata and controls
59 lines (46 loc) · 1.45 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
"""Fixtures used by pytest."""
import datetime
import pathlib
import numpy as np
import pandas as pd
import pytest
from graphomotor.core import models
from graphomotor.utils import reference_spiral
@pytest.fixture
def sample_data() -> pathlib.Path:
"""Sample data for tests."""
return (
pathlib.Path(__file__).parent
/ "sample_data"
/ "[5123456]d3afad5c-8a5d-4292-8f54-24109ea6f793-648c7b3e-8819-c112-0b4f-6f3000000000-spiral_trace1_Dom.csv" # noqa: E501
)
@pytest.fixture
def valid_spiral_data(sample_data: pathlib.Path) -> pd.DataFrame:
"""Create a valid DataFrame for spiral data."""
return pd.read_csv(sample_data)
@pytest.fixture
def valid_spiral_metadata() -> dict[str, str | datetime.datetime]:
"""Create valid metadata for spiral."""
return {
"id": "5123456",
"hand": "Dom",
"task": "spiral_trace1",
"start_time": datetime.datetime.fromtimestamp(
1701700376.296,
tz=datetime.timezone.utc,
),
}
@pytest.fixture
def valid_spiral(
valid_spiral_data: pd.DataFrame,
valid_spiral_metadata: dict[str, str | datetime.datetime],
) -> models.Spiral:
"""Create a valid Spiral object."""
return models.Spiral(
data=valid_spiral_data,
metadata=valid_spiral_metadata,
)
@pytest.fixture
def ref_spiral() -> np.ndarray:
"""Create a reference spiral for testing."""
return reference_spiral.generate_reference_spiral()