Test autogetting result filename
This commit is contained in:
parent
7c5587aeaa
commit
d999fa2a7e
@ -59,7 +59,7 @@ def load_backtest_stats(filename: Union[Path, str]) -> Dict[str, Any]:
|
||||
if isinstance(filename, str):
|
||||
filename = Path(filename)
|
||||
if filename.is_dir():
|
||||
filename = get_latest_backtest_filename(filename)
|
||||
filename = filename / get_latest_backtest_filename(filename)
|
||||
if not filename.is_file():
|
||||
raise ValueError(f"File {filename} does not exist.")
|
||||
logger.info(f"Loading backtest result from {filename}")
|
||||
|
@ -70,6 +70,10 @@ def test_load_backtest_data_new_format(testdatadir):
|
||||
bt_data2 = load_backtest_data(str(filename))
|
||||
assert bt_data.equals(bt_data2)
|
||||
|
||||
# Test loading from folder (must yield same result)
|
||||
bt_data3 = load_backtest_data(testdatadir)
|
||||
assert bt_data.equals(bt_data3)
|
||||
|
||||
with pytest.raises(ValueError, match=r"File .* does not exist\."):
|
||||
load_backtest_data(str("filename") + "nofile")
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user