1
0
mirror of https://github.com/microsoft/qlib.git synced 2026-07-14 16:26:55 +08:00

Supporting shared processor (#596)

* Supporting shared processor

* fix readonly reverse bug

* remove pytests dependency

* with fit bug

* fix parameter error
This commit is contained in:
you-n-g
2021-09-13 17:11:08 +08:00
committed by GitHub
parent 28c99c77be
commit 51709c20d8
3 changed files with 92 additions and 33 deletions

View File

@@ -5,7 +5,6 @@
from pathlib import Path
from collections.abc import Iterable
import pytest
import numpy as np
from qlib.tests import TestAutoData
@@ -33,13 +32,13 @@ class TestStorage(TestAutoData):
print(f"calendar[-1]: {calendar[-1]}")
calendar = CalendarStorage(freq="1min", future=False, provider_uri="not_found")
with pytest.raises(ValueError):
with self.assertRaises(ValueError):
print(calendar.data)
with pytest.raises(ValueError):
with self.assertRaises(ValueError):
print(calendar[:])
with pytest.raises(ValueError):
with self.assertRaises(ValueError):
print(calendar[0])
def test_instrument_storage(self):
@@ -90,10 +89,10 @@ class TestStorage(TestAutoData):
print(f"instrument['SH600000']: {instrument['SH600000']}")
instrument = InstrumentStorage(market="csi300", provider_uri="not_found")
with pytest.raises(ValueError):
with self.assertRaises(ValueError):
print(instrument.data)
with pytest.raises(ValueError):
with self.assertRaises(ValueError):
print(instrument["sSH600000"])
def test_feature_storage(self):
@@ -152,7 +151,7 @@ class TestStorage(TestAutoData):
feature = FeatureStorage(instrument="SH600004", field="close", freq="day", provider_uri=self.provider_uri)
with pytest.raises(IndexError):
with self.assertRaises(IndexError):
print(feature[0])
assert isinstance(
feature[815][1], (float, np.float32)