Esempio n. 1
0
def test_MPR5_matches_MPT5():
    mpr = MPRfile(os.path.join(testdata_dir, 'bio_logic5.mpr'))
    mpt, comments = MPTfile(
        (re.sub(b'\tXXX\t', b'\t0\t', line)
         for line in open(os.path.join(testdata_dir, 'bio_logic5.mpt'),
                          mode='rb')))
    assert_MPR_matches_MPT(mpr, mpt, comments)
Esempio n. 2
0
def test_MPR_dates(testdata_dir, 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:
        assert mpr.enddate.strftime('%Y-%m-%d') == enddate
    else:
        assert not hasattr(mpr, 'enddate')
Esempio n. 3
0
def test_MPR_matches_MPT(testdata_dir, basename):
    """Check the MPR parser against the MPT parser.

    Load a binary .mpr file and a text .mpt file which should contain
    exactly the same data. Check that the loaded data actually match.
    """
    binpath = os.path.join(testdata_dir, basename + '.mpr')
    txtpath = os.path.join(testdata_dir, basename + '.mpt')
    mpr = MPRfile(binpath)
    mpt, comments = MPTfile(txtpath)
    assert_MPR_matches_MPT(mpr, mpt, comments)
Esempio n. 4
0
def test_open_MPR_fails_for_bad_file():
    mpr1 = MPRfile(os.path.join(testdata_dir, 'arbin1.res'))
Esempio n. 5
0
def test_open_MPR6():
    mpr = MPRfile(os.path.join(testdata_dir, 'bio_logic6.mpr'))
    ## Check the dates as a basic test that it has been read properly
    eq_(mpr.startdate, date(2012, 9, 11))
Esempio n. 6
0
def test_open_MPR5():
    mpr = MPRfile(os.path.join(testdata_dir, 'bio_logic5.mpr'))
    ## Check the dates as a basic test that it has been read properly
    eq_(mpr.startdate, date(2013, 1, 28))
    eq_(mpr.enddate, date(2013, 1, 28))
Esempio n. 7
0
def test_open_MPR2():
    mpr2 = MPRfile(os.path.join(testdata_dir, 'bio_logic2.mpr'))
    ## Check the dates as a basic test that it has been read properly
    eq_(mpr2.startdate, date(2012, 9, 27))
    eq_(mpr2.enddate, date(2012, 9, 27))
Esempio n. 8
0
def test_open_MPR1():
    mpr1 = MPRfile(os.path.join(testdata_dir, 'bio_logic1.mpr'))
    ## Check the dates as a basic test that it has been read properly
    eq_(mpr1.startdate, date(2011, 10, 29))
    eq_(mpr1.enddate, date(2011, 10, 31))
Esempio n. 9
0
def test_CA_455nm():
    mpr = MPRfile(os.path.join(testdata_dir, '121_CA_455nm_6V_30min_C01.mpr'))
    mpt, comments = MPTfile(
        os.path.join(testdata_dir, '121_CA_455nm_6V_30min_C01.mpt'))
    assert_MPR_matches_MPT(mpr, mpt, comments)
Esempio n. 10
0
def test_CV_C01():
    mpr = MPRfile(os.path.join(testdata_dir, 'CV_C01.mpr'))
    mpt, comments = MPTfile(os.path.join(testdata_dir, 'CV_C01.mpt'))
    assert_MPR_matches_MPT(mpr, mpt, comments)
Esempio n. 11
0
def test_MPR6_matches_MPT6():
    mpr = MPRfile(os.path.join(testdata_dir, 'bio_logic6.mpr'))
    mpt, comments = MPTfile(os.path.join(testdata_dir, 'bio_logic6.mpt'))
    mpr.data = mpr.data[:958]  # .mpt file is incomplete
    assert_MPR_matches_MPT(mpr, mpt, comments)
Esempio n. 12
0
def test_MPR4_matches_MPT4():
    mpr4 = MPRfile(os.path.join(testdata_dir, 'bio_logic4.mpr'))
    mpt4, comments = MPTfile(os.path.join(testdata_dir, 'bio_logic4.mpt'))
    assert_MPR_matches_MPT(mpr4, mpt4, comments)
Esempio n. 13
0
def test_MPR2_matches_MPT2():
    mpr2 = MPRfile(os.path.join(testdata_dir, 'bio_logic2.mpr'))
    mpt2, comments = MPTfile(os.path.join(testdata_dir, 'bio_logic2.mpt'))
    assert_MPR_matches_MPT(mpr2, mpt2, comments)
Esempio n. 14
0
def test_MPR1_matches_MPT1():
    mpr1 = MPRfile(os.path.join(testdata_dir, 'bio_logic1.mpr'))
    mpt1, comments = MPTfile(os.path.join(testdata_dir, 'bio_logic1.mpt'))
    assert_MPR_matches_MPT(mpr1, mpt1, comments)
Esempio n. 15
0
def test_MPR6_matches_MPT6():
    mpr = MPRfile(os.path.join(testdata_dir, 'bio_logic6.mpr'))
    mpt, comments = MPTfile(os.path.join(testdata_dir, 'bio_logic6.mpt'))
    mpr.data = mpr.data[:958]  # .mpt file is incomplete
    assert_MPR_matches_MPT(mpr, mpt, comments)
Esempio n. 16
0
def test_open_MPR_fails_for_bad_file(testdata_dir):
    with pytest.raises(ValueError, match='Invalid magic for .mpr file'):
        MPRfile(os.path.join(testdata_dir, 'arbin1.res'))