def test_validate_fen(self): # valid for variant, positions in variant_positions.items(): for fen in positions: self.assertEqual(sf.validate_fen(fen, variant), sf.FEN_OK, "{}: {}".format(variant, fen)) # invalid for variant, positions in invalid_variant_positions.items(): for fen in positions: self.assertNotEqual(sf.validate_fen(fen, variant), sf.FEN_OK, "{}: {}".format(variant, fen)) # chess960 self.assertEqual(sf.validate_fen(CHESS960, "chess", True), sf.FEN_OK, "{}: {}".format(variant, fen)) self.assertEqual(sf.validate_fen("nrbqbkrn/pppppppp/8/8/8/8/PPPPPPPP/NRBQBKRN w BGbg - 0 1", "newzealand", True), sf.FEN_OK, "{}: {}".format(variant, fen)) # all variants starting positions for variant in sf.variants(): fen = sf.start_fen(variant) self.assertEqual(sf.validate_fen(fen, variant), sf.FEN_OK, "{}: {}".format(variant, fen))
def test_validate_fen(self): for variant, positions in variant_positions.items(): for fen in positions: self.assertTrue(sf.validate_fen(fen, variant) == 1, "{}: {}".format(variant, fen))