mirror of
https://github.com/echemdata/galvani.git
synced 2025-12-14 01:15:34 +00:00
Add a test for the parse_BioLogic_date function
This commit is contained in:
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
import os.path
|
import os.path
|
||||||
import re
|
import re
|
||||||
from datetime import datetime
|
from datetime import date, datetime
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from numpy.testing import assert_array_almost_equal, assert_array_equal
|
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
|
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', [
|
@pytest.mark.parametrize('filename, startdate, enddate', [
|
||||||
('bio_logic1.mpr', '2011-10-29', '2011-10-31'),
|
('bio_logic1.mpr', '2011-10-29', '2011-10-31'),
|
||||||
('bio_logic2.mpr', '2012-09-27', '2012-09-27'),
|
('bio_logic2.mpr', '2012-09-27', '2012-09-27'),
|
||||||
|
|||||||
Reference in New Issue
Block a user