diff --git a/test.py b/test.py index 93cc16d2c..bd5c4f295 100644 --- a/test.py +++ b/test.py @@ -975,15 +975,30 @@ def test_is_capture(self): self.assertFalse(result) def test_piece_to_partner(self): + # take the rook and promote to queen result = sf.piece_to_partner("bughouse", "r2qkbnr/1Ppppppp/2n5/8/8/8/1PPPPPPP/RNBQKBNR[] w KQkq - 0 1", ["b7a8q"]) self.assertEqual(result, "r") + # take back the queen (promoted pawn) result = sf.piece_to_partner("bughouse", "r2qkbnr/1Ppppppp/2n5/8/8/8/1PPPPPPP/RNBQKBNR[] w KQkq - 0 1", ["b7a8q", "d8a8"]) self.assertEqual(result, "P") + # just a simple move (no take) result = sf.piece_to_partner("bughouse", "r2qkbnr/1Ppppppp/2n5/8/8/8/1PPPPPPP/RNBQKBNR[] w KQkq - 0 1", ["b7a8q", "d8b8"]) self.assertEqual(result, "") + # take the pawn and promote to tokin + result = sf.piece_to_partner("shogi", "lnsgkgsnl/1r5b1/ppppppp1p/1P7/9/7p1/P1PPPPPPP/1B5R1/LNSGKGSNL[] w 0 1", ["b6b7+"]) + self.assertEqual(result, "p") + + # take back the promoted pawn + result = sf.piece_to_partner("shogi", "lnsgkgsnl/1r5b1/ppppppp1p/1P7/9/7p1/P1PPPPPPP/1B5R1/LNSGKGSNL[] w 0 1", ["b6b7+", "b8b7"]) + self.assertEqual(result, "P") + + # take an unpromoted pawn + result = sf.piece_to_partner("shogi", "lnsgkgsnl/1r5b1/ppppppp1p/1P7/9/7p1/P1PPPPPPP/1B5R1/LNSGKGSNL[] w 0 1", ["b6b7+", "h4h3+"]) + self.assertEqual(result, "P") + def test_game_result(self): result = sf.game_result("chess", CHESS, ["f2f3", "e7e5", "g2g4", "d8h4"]) self.assertEqual(result, -sf.VALUE_MATE)