1
0
mirror of https://github.com/microsoft/qlib.git synced 2026-06-06 05:51:17 +08:00
This commit is contained in:
Linlang
2022-06-28 10:17:29 +08:00
committed by GitHub
parent a87b02619a
commit 50d74b5560
12 changed files with 175 additions and 144 deletions

View File

@@ -1,4 +1,6 @@
[pytest]
markers =
slow: marks tests as slow (deselect with '-m "not slow"')
filterwarnings =
ignore:.*rng.randint:DeprecationWarning
ignore:.*Casting input x to numpy array:UserWarning

View File

@@ -1,5 +1,6 @@
import copy
import unittest
import pytest
import fire
import pandas as pd
@@ -14,6 +15,7 @@ from qlib.workflow.online.update import LabelUpdater
class TestRolling(TestAutoData):
@pytest.mark.slow
def test_update_pred(self):
"""
This test is for testing if it will raise error if the `to_date` is out of the boundary.
@@ -73,6 +75,7 @@ class TestRolling(TestAutoData):
# this range is fixed now
self.assertTrue((updated_pred.loc[mod_range2] == -2).all().item())
@pytest.mark.slow
def test_update_label(self):
task = copy.deepcopy(CSI300_GBDT_TASK)

View File

@@ -4,6 +4,7 @@
import sys
import shutil
import unittest
import pytest
from pathlib import Path
import qlib
@@ -184,16 +185,19 @@ class TestAllFlow(TestAutoData):
def tearDownClass(cls) -> None:
shutil.rmtree(cls.URI_PATH.lstrip("file:"))
@pytest.mark.slow
def test_0_train_with_sigana(self):
TestAllFlow.PRED_SCORE, ic_ric, uri_path = train_with_sigana(self.URI_PATH)
self.assertGreaterEqual(ic_ric["ic"].all(), 0, "train failed")
self.assertGreaterEqual(ic_ric["ric"].all(), 0, "train failed")
@pytest.mark.slow
def test_1_train(self):
TestAllFlow.PRED_SCORE, ic_ric, TestAllFlow.RID = train(self.URI_PATH)
self.assertGreaterEqual(ic_ric["ic"].all(), 0, "train failed")
self.assertGreaterEqual(ic_ric["ric"].all(), 0, "train failed")
@pytest.mark.slow
def test_2_backtest(self):
analyze_df = backtest_analysis(TestAllFlow.PRED_SCORE, TestAllFlow.RID, self.URI_PATH)
self.assertGreaterEqual(
@@ -203,6 +207,7 @@ class TestAllFlow(TestAutoData):
)
self.assertTrue(not analyze_df.isna().any().any(), "backtest failed")
@pytest.mark.slow
def test_3_expmanager(self):
pass_default, pass_current, uri_path = fake_experiment()
self.assertTrue(pass_default, msg="default uri is incorrect")

View File

@@ -4,6 +4,7 @@
from qlib.workflow.record_temp import SignalRecord
import shutil
import unittest
import pytest
from pathlib import Path
from qlib.contrib.workflow import MultiSegRecord, SignalMseRecord
@@ -47,9 +48,11 @@ class TestAllFlow(TestAutoData):
def tearDownClass(cls) -> None:
shutil.rmtree(cls.URI_PATH.lstrip("file:"))
@pytest.mark.slow
def test_0_multiseg(self):
uri_path = train_multiseg(self.URI_PATH)
@pytest.mark.slow
def test_1_mse(self):
uri_path = train_mse(self.URI_PATH)

View File

@@ -2,6 +2,7 @@
# Licensed under the MIT License.
import unittest
import pytest
import sys
from qlib.tests import TestAutoData
from qlib.data.dataset import TSDatasetH
@@ -11,6 +12,7 @@ from qlib.data.dataset.handler import DataHandlerLP
class TestDataset(TestAutoData):
@pytest.mark.slow
def testTSDataset(self):
tsdh = TSDatasetH(
handler={

View File

@@ -6,12 +6,13 @@ import sys
import qlib
import shutil
import unittest
import pytest
import pandas as pd
import baostock as bs
from pathlib import Path
from qlib.data import D
from scripts.get_data import GetData
from qlib.tests.data import GetData
from scripts.dump_pit import DumpPitData
sys.path.append(str(Path(__file__).resolve().parent.parent.joinpath("scripts/data_collector/pit")))
@@ -119,6 +120,7 @@ class TestPIT(unittest.TestCase):
"""
self.check_same(data, expect)
@pytest.mark.slow
def test_expr(self):
fields = [
"P(Mean($$roewa_q, 1))",