-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconftest.py
More file actions
58 lines (46 loc) · 1.33 KB
/
conftest.py
File metadata and controls
58 lines (46 loc) · 1.33 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
import pytest
import numpy as np
import matplotlib
import mylogging
import mypythontools
mypythontools.tests.setup_tests(matplotlib_test_backend=True)
import predictit
from predictit.configuration import config
config_for_tests = {
"is_tested": True,
"predicted_column": 0,
"logger_level": "WARNING",
"logger_color": False,
"show_plot": False,
"data": "test_sin",
"datalength": 120,
"default_n_steps_in": 3,
"analyzeit": 0,
"optimization": False,
"optimizeit": False,
"used_models": [
"AR",
"Conjugate gradient",
"Sklearn regression",
],
"print_time_table": False,
"print_result_details": False,
"print_comparison_result_details": False,
"print_table": None,
"print_comparison_table": None,
"analyze_seasonal_decompose": None,
}
@pytest.fixture(autouse=True)
def setup_tests(doctest_namespace):
doctest_namespace["predictit"] = predictit
doctest_namespace["mylogging"] = mylogging
doctest_namespace["matplotlib"] = matplotlib
# Config reset to default for each test
config.reset()
config.update(config_for_tests)
def validate_result(data):
"""Return true if result is valid. It means no np.nan in results.
Args:
data (np.array, pd.DataFrame): Tested data.
"""
return not np.isnan(np.array(data).min())