From 2471148c21fd7c0bd1af83c57616d3b21a6035ca Mon Sep 17 00:00:00 2001 From: Chris Kerr Date: Sat, 30 Mar 2019 15:34:22 +0100 Subject: [PATCH] Add new test data file with different date format This tests for issue #20 Thanks @JBWarrington for providing this file --- get_testdata.sh | 1 + tests/test_BioLogic.py | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/get_testdata.sh b/get_testdata.sh index c571c6f..792223a 100755 --- a/get_testdata.sh +++ b/get_testdata.sh @@ -23,4 +23,5 @@ https://files.figshare.com/1780529/121_CA_455nm_6V_30min_C01.mpr https://files.figshare.com/1780530/121_CA_455nm_6V_30min_C01.mpt https://files.figshare.com/1780526/CV_C01.mpr https://files.figshare.com/1780527/CV_C01.mpt +https://files.figshare.com/14752538/C019P-0ppb-A_C01.mpr END_FILELIST diff --git a/tests/test_BioLogic.py b/tests/test_BioLogic.py index de0da1d..f42e85d 100644 --- a/tests/test_BioLogic.py +++ b/tests/test_BioLogic.py @@ -52,13 +52,15 @@ def test_open_MPT_csv_fails_for_bad_file(): ('bio_logic5.mpr', '2013-01-28', '2013-01-28'), # bio_logic6.mpr has no end date because it does not have a VMP LOG module ('bio_logic6.mpr', '2012-09-11', None), + # C019P-0ppb-A_C01.mpr stores the date in a different format + ('C019P-0ppb-A_C01.mpr', '2019-03-14', '2019-03-14'), ]) def test_MPR_dates(filename, startdate, enddate): """Check that the start and end dates in .mpr files are read correctly.""" mpr = MPRfile(os.path.join(testdata_dir, filename)) assert mpr.startdate.strftime('%Y-%m-%d') == startdate if enddate: - mpr.enddate.strftime('%Y-%m-%d') == enddate + assert mpr.enddate.strftime('%Y-%m-%d') == enddate else: assert not hasattr(mpr, 'enddate')