예제 #1
0
def test_validated():
    '''Test that the human validated csv strings work'''
    for fenex, csvex in fenstrs.items():
        print("passed")
        fen = fencsv.tofen(csvex)
        assert fen == fenex
        csv = fencsv.tocsv(fenex)
        assert csv == csvex
예제 #2
0
def test_back_forth():
    '''Test that fen strings can be converted back and forth'''
    # i = 0
    for fenex in fenstrs:
        csv = fencsv.tocsv(fenex)
        fen = fencsv.tofen(csv)
        assert fen == fenex
        # i += 1; print("## TEST {i}\n{fen}\n{csv}\n".format(i=i, fen=fen, csv=csv))
        converted = do_convert(fenex, 2)
        assert converted == fenex
        converted = do_convert(fenex, 10)
        assert converted == fenex
예제 #3
0
def do_convert(fenstr, times=2):
    '''convert the fenstr back and forth several times'''
    for _ in range(times):
        fenstr = fencsv.tofen(fencsv.tocsv(fenstr))
    return fenstr