Skip to content

Commit

Permalink
Add test for reading game with mulit-comment moves
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkZH committed Feb 21, 2024
1 parent 05da598 commit c060308
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2215,6 +2215,14 @@ def test_read_game(self):
self.assertEqual(sixth_game.headers["White"], "Deep Blue (Computer)")
self.assertEqual(sixth_game.headers["Result"], "1-0")

def test_read_game_with_multicomment_move(self):
pgn = io.StringIO("1. e4 {A common opening} 1... e5 {A common response} {An uncommon comment}")
game = chess.pgn.read_game(pgn)
first_move = game.variation(0)
self.assertEqual(first_move.comment, ["A common opening"])
second_move = first_move.variation(0)
self.assertEqual(second_move.comment, ["A common response", "An uncommon comment"])

def test_comment_at_eol(self):
pgn = io.StringIO(textwrap.dedent("""\
1. e4 e5 2. Nf3 Nc6 3. Bc4 Bc5 4. c3 Nf6 5. d3 d6 6. Nbd2 a6 $6 (6... Bb6 $5 {
Expand Down

0 comments on commit c060308

Please sign in to comment.