Add new test data file with different date format

This tests for issue #20

Thanks @JBWarrington for providing this file
This commit is contained in:
2019-03-30 15:34:22 +01:00
parent 7a5887fb38
commit 2471148c21
2 changed files with 4 additions and 1 deletions

View File

@@ -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/1780530/121_CA_455nm_6V_30min_C01.mpt
https://files.figshare.com/1780526/CV_C01.mpr https://files.figshare.com/1780526/CV_C01.mpr
https://files.figshare.com/1780527/CV_C01.mpt https://files.figshare.com/1780527/CV_C01.mpt
https://files.figshare.com/14752538/C019P-0ppb-A_C01.mpr
END_FILELIST END_FILELIST

View File

@@ -52,13 +52,15 @@ def test_open_MPT_csv_fails_for_bad_file():
('bio_logic5.mpr', '2013-01-28', '2013-01-28'), ('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 has no end date because it does not have a VMP LOG module
('bio_logic6.mpr', '2012-09-11', None), ('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): def test_MPR_dates(filename, startdate, enddate):
"""Check that the start and end dates in .mpr files are read correctly.""" """Check that the start and end dates in .mpr files are read correctly."""
mpr = MPRfile(os.path.join(testdata_dir, filename)) mpr = MPRfile(os.path.join(testdata_dir, filename))
assert mpr.startdate.strftime('%Y-%m-%d') == startdate assert mpr.startdate.strftime('%Y-%m-%d') == startdate
if enddate: if enddate:
mpr.enddate.strftime('%Y-%m-%d') == enddate assert mpr.enddate.strftime('%Y-%m-%d') == enddate
else: else:
assert not hasattr(mpr, 'enddate') assert not hasattr(mpr, 'enddate')