def test_eco_json(self):
        ecofile = os.path.join(os.path.dirname(__file__), '../eco/eco.json')
        ecodata = json.load(open(ecofile, 'r'))

        for row in ecodata:
            fen = "{} {}".format(row["f"], '- 0 1')
            chess.Board(fen=fen)

            classification = annotator.classify_fen(row["f"], ecodata)

            assert classification["code"] == row["c"]
            assert classification["desc"] == row["n"]
            assert classification["path"] == row["m"]
Esempio n. 2
0
    def test_eco_tsv(self):
        ecopath = os.path.join(os.path.dirname(__file__), 'eco/a.tsv')
        with open(ecopath, 'r') as ecofile:
            reader = csv.reader(ecofile, delimiter='\t')

            next(reader)
            for row in reader:
                code, desc, fen, path = row
                chess.Board(fen + ' 0 1')

                classification = annotator.classify_fen(fen, ecopath)

                assert code == classification["code"]
                assert desc == classification["desc"]
                assert path == classification["path"]