Merge pull request #63 from chatcannon/time-format-dotted

Add '%m.%d.%y' date format for .mpr file timestamps
This commit is contained in:
2021-09-01 07:06:58 +03:00
committed by GitHub
2 changed files with 41 additions and 12 deletions

View File

@@ -6,7 +6,7 @@
import os.path
import re
from datetime import datetime
from datetime import date, datetime
import numpy as np
from numpy.testing import assert_array_almost_equal, assert_array_equal
@@ -77,6 +77,24 @@ def test_colID_to_dtype(colIDs, expected):
assert dtype == expected_dtype
@pytest.mark.parametrize('data, expected', [
('02/23/17', date(2017, 2, 23)),
('10-03-05', date(2005, 10, 3)),
('11.12.20', date(2020, 11, 12)),
(b'01/02/03', date(2003, 1, 2)),
('13.08.07', ValueError),
('03-04/05', ValueError),
])
def test_parse_BioLogic_date(data, expected):
"""Test the parse_BioLogic_date function."""
if isinstance(expected, type) and issubclass(expected, Exception):
with pytest.raises(expected):
BioLogic.parse_BioLogic_date(data)
return
result = BioLogic.parse_BioLogic_date(data)
assert result == expected
@pytest.mark.parametrize('filename, startdate, enddate', [
('bio_logic1.mpr', '2011-10-29', '2011-10-31'),
('bio_logic2.mpr', '2012-09-27', '2012-09-27'),