24 lines
800 B
Python
24 lines
800 B
Python
|
|
from __future__ import annotations
|
||
|
|
|
||
|
|
import numpy as np
|
||
|
|
import pytest
|
||
|
|
|
||
|
|
pytest.importorskip("torch")
|
||
|
|
from gpu_batch01_v1_1_runner import read_ohlcv, role_semantics, write_ohlcv_csv
|
||
|
|
|
||
|
|
|
||
|
|
def test_runner_csv_round_trip_and_explicit_missing_role_semantics(tmp_path):
|
||
|
|
path = tmp_path / "ohlcv.csv"
|
||
|
|
expected = {
|
||
|
|
"close": np.array([100.0, 101.0]),
|
||
|
|
"high": np.array([101.0, 102.0]),
|
||
|
|
"low": np.array([99.0, 100.0]),
|
||
|
|
"volume": np.array([1000.0, 1001.0]),
|
||
|
|
}
|
||
|
|
write_ohlcv_csv(path, expected)
|
||
|
|
actual = read_ohlcv(path)
|
||
|
|
assert all(np.array_equal(actual[name], values) for name, values in expected.items())
|
||
|
|
semantics = role_semantics(None)
|
||
|
|
assert semantics["status"] == "not_reconstructable"
|
||
|
|
assert "no strategy-role assignment" in semantics["reason"]
|