deepdog/tests/results/test_parse_filename.py
Deepak Mallubhotla 46f6b6cdf1
All checks were successful
gitea-physics/deepdog/pipeline/head This commit looks good
feat: Adds ability to parse bayesruns without timestamps
2025-02-26 21:01:19 -06:00

20 lines
595 B
Python

import deepdog.results
import pytest
def test_parse_bayesrun_filename():
valid1 = "20250226-204120-dot1-dot1-2-0.realdata.fast_filter.bayesrun.csv"
timestamp, slug = deepdog.results._parse_string_output_filename(valid1)
assert timestamp == "20250226-204120"
assert slug == "dot1-dot1-2-0"
valid2 = "dot1-dot1-2-0.realdata.fast_filter.bayesrun.csv"
timestamp, slug = deepdog.results._parse_string_output_filename(valid2)
assert timestamp is None
assert slug == "dot1-dot1-2-0"
with pytest.raises(ValueError):
deepdog.results._parse_string_output_filename("not_a_valid_filename")