def test_enums_export():
    f = io.BytesIO('FormatVersion=5.0 // Do not edit this line!\nTitle="An Example Title"\n\n{ENUMS}\nenum Animal(0="Dog",1="Cat",2="Fox")\n\n{SENDRECEIVE}\n\n[Frame1]\nID=000h\nDLC=8\nVar=Signal1 unsigned 0,16\n'.encode('utf-8'))
    matrix = canmatrix.formats.sym.load(f)
    assert (matrix.load_errors == []), 'Failed to load canmatrix'
    matrix.frame_by_name('Frame1').signal_by_name('Signal1').enumeration = 'Plants'
    matrix.frame_by_name('Frame1').signal_by_name('Signal1').values = {0: 'Grass', 1: 'Flower', 2: 'Tree'}
    f_out = io.BytesIO()
    canmatrix.formats.sym.dump(matrix, f_out)
    f_in = io.BytesIO(f_out.getvalue())
    new_matrix = canmatrix.formats.sym.load(f_in)
    assert (new_matrix.value_tables['Animal'] == {0: 'Dog', 1: 'Cat', 2: 'Fox'})
    assert (new_matrix.value_tables['Plants'] == {0: 'Grass', 1: 'Flower', 2: 'Tree'})
def test_enums_export():
    f = io.BytesIO('FormatVersion=5.0 // Do not edit this line!\nTitle="An Example Title"\n\n{ENUMS}\nenum Animal(0="Dog",1="Cat",2="Fox")\n\n{SENDRECEIVE}\n\n[Frame1]\nID=000h\nDLC=8\nVar=Signal1 unsigned 0,16\n'.encode('utf-8'))
    matrix = canmatrix.formats.sym.load(f)
    assert (matrix.load_errors == []), 'Failed to load canmatrix'
    matrix.frame_by_name('Frame1').signal_by_name('Signal1').enumeration = 'Plants'
    matrix.frame_by_name('Frame1').signal_by_name('Signal1').values = {0: 'Grass', 1: 'Flower', 2: 'Tree'}
    f_out = io.BytesIO()
    canmatrix.formats.sym.dump(matrix, f_out)
    f_in = io.BytesIO(f_out.getvalue())
    new_matrix = canmatrix.formats.sym.load(f_in)
    assert (new_matrix.value_tables['Animal'] == {0: 'Dog', 1: 'Cat', 2: 'Fox'})
    assert (new_matrix.value_tables['Plants'] == {0: 'Grass', 1: 'Flower', 2: 'Tree'})