Exemplo n.º 1
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
Exemplo n.º 2
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
Exemplo n.º 3
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
Exemplo n.º 4
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