Skip to content

Commit

Permalink
Add a test for the parse_BioLogic_date function
Browse files Browse the repository at this point in the history
  • Loading branch information
chatcannon committed Jul 3, 2021
1 parent 4ebdc66 commit bcd7c5a
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion tests/test_BioLogic.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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'),
Expand Down

0 comments on commit bcd7c5a

Please sign in to comment.