Ejemplo n.º 1
0
def test_merge_files_doctest(tmppath, datapath):
    path_merge1 = str(datapath / 'merge1.mot')
    path_merge2 = str(datapath / 'merge2.hex')
    path_merged_out = str(tmppath / 'merged.tek')
    path_merged_ref = str(datapath / 'merged.tek')
    merge_files([path_merge1, path_merge2], path_merged_out)
    ans_out = load_records(path_merged_out)
    ans_ref = load_records(path_merged_ref)
    assert ans_out == ans_ref
Ejemplo n.º 2
0
def test_merge_files(tmppath, datapath):
    path_merge1 = str(datapath / 'merge1.mot')
    path_merge2 = str(datapath / 'merge2.hex')
    path_merged_out = str(tmppath / 'merged.tek')
    path_merged_ref = str(datapath / 'merged.tek')
    merge_files([path_merge1, path_merge2], path_merged_out,
                [MotorolaRecord, IntelRecord], TektronixRecord)
    ans_out = load_records(path_merged_out)
    ans_ref = load_records(path_merged_ref)
    assert ans_out == ans_ref
Ejemplo n.º 3
0
def test_save_records_doctest(tmppath):
    path = str(tmppath / 'bytes.hex')
    records = list(IntelRecord.split(BYTES))
    save_records(path, records)
    ans_out = load_records(path)
    ans_ref = records
    assert ans_out == ans_ref
Ejemplo n.º 4
0
def test_load_records(tmppath):
    path = str(tmppath / 'bytes.mot')
    records = list(MotorolaRecord.split(BYTES))
    save_records(path, records)
    ans_out = load_records(path, MotorolaRecord)
    ans_ref = records
    assert ans_out == ans_ref
Ejemplo n.º 5
0
def test_convert_file_doctest(tmppath):
    path_mot = str(tmppath / 'bytes.mot')
    path_hex = str(tmppath / 'bytes.hex')
    motorola = list(MotorolaRecord.split(BYTES))
    intel = list(IntelRecord.split(BYTES))
    save_records(path_mot, motorola)
    convert_file(path_mot, path_hex)
    ans_out = load_records(path_hex)
    ans_ref = intel
    assert ans_out == ans_ref
Ejemplo n.º 6
0
def test_save_records(tmppath):
    path = str(tmppath / 'bytes.hex')
    records = list(IntelRecord.split(BYTES))
    save_records(path, records, IntelRecord)
    ans_out = load_records(path)
    ans_ref = records
    assert ans_out == ans_ref

    records = []
    save_records(path, records, IntelRecord)
    ans_out = load_records(path)
    ans_ref = records
    assert ans_out == ans_ref

    path = str(tmppath / 'bytes.mot')
    intel = list(IntelRecord.split(BYTES))
    motorola = list(MotorolaRecord.split(BYTES))
    save_records(path, intel, MotorolaRecord)
    ans_out = load_records(path)
    ans_ref = motorola
    assert ans_out == ans_ref