Exemple #1
0
def test_noheader_acq_error(samefreq_noheader_txt_file):
    chtrig = 2
    with raises(AttributeError) as errorinfo:
        txt.populate_phys_input(samefreq_noheader_txt_file, chtrig=chtrig)
    assert 'not supported' in str(errorinfo.value)

    # test file without header for process_acq
    header, channels = txt.read_header_and_channels(samefreq_noheader_txt_file)
    with raises(AttributeError) as errorinfo:
        txt.process_acq(channels, chtrig=chtrig)
    assert 'not supported' in str(errorinfo.value)
Exemple #2
0
def test_process_acq_errors(loaded_acq_file):
    header, channels, chtrig = loaded_acq_file

    # test file without header
    with raises(AttributeError) as errorinfo:
        txt.process_acq(channels, chtrig=chtrig)
    assert 'not supported' in str(errorinfo.value)

    # test when units are not valid:
    header[1][0] = '1 GHz'
    with raises(AttributeError) as errorinfo:
        txt.process_acq(channels, chtrig=chtrig, header=header)
    assert 'not in a valid AcqKnowledge' in str(errorinfo.value)
Exemple #3
0
def test_process_acq(loaded_acq_file, units, expected):
    header, channels, chtrig = loaded_acq_file

    # set units to test that expected frequency is generated correctly
    header[1][0] = units
    phys_obj = txt.process_acq(channels, chtrig=chtrig, header=header)
    assert math.isclose(phys_obj.freq[0], expected)