def it_parses_regular_board(self):
     src = " ##########\n    \n" + " ## @ *   #\n" + "##  $ ####\n" + "# $.+ #\n" + "#######\n"
     result = [
         " ##########",
         "           ",
         " ## @ *   #",
         "##  $ #### ",
         "# $.+ #    ",
         "#######    ",
         "           ",
     ]
     parsed = parse_board_string(src)
     assert parsed == result
 def it_parses_RLE_board(self):
     src = " ##########   |" + " ## @ *   #|" + "##  $ ####|" + "# $.+ #|||" + "#######   |"
     result = [
         " ##########   ",
         " ## @ *   #   ",
         "##  $ ####    ",
         "# $.+ #       ",
         "              ",
         "              ",
         "#######       ",
         "              ",
     ]
     parsed = parse_board_string(src)
     assert parsed == result
 def it_discards_empty_but_not_blank_lines(self):
     src = " ##########\n    \n\n" + " ## @ *   #\n\n" + "##  $ ####\n\n" + "# $.+ #\n\n" + "#######\n\n"
     result = [
         " ##########",
         "           ",
         "           ",
         " ## @ *   #",
         "           ",
         "##  $ #### ",
         "           ",
         "# $.+ #    ",
         "           ",
         "#######    ",
         "           ",
         "           ",
     ]
     parsed = parse_board_string(src)
     assert parsed == result
 def it_discards_blank_boards(self):
     src = "              "
     parsed = parse_board_string(src)
     assert parsed == []
 def it_raises_on_illegal_characters(self):
     src = " ##########\n\n" + " ##       #\n" + "##   z####\n" + "#   a #\n" + "#######\n"
     with pytest.raises(BoardConversionError):
         parse_board_string(src)