def test_input_with_a_number_of_lines_that_is_not_a_multiple_of_four_raises_an_error(
     self, ):
     with self.assertRaises(ValueError) as err:
         convert([" _ ", "| |", "   "])
     self.assertEqual(type(err.exception), ValueError)
     self.assertEqual(err.exception.args[0],
                      "Number of input lines is not a multiple of four")
 def test_input_with_a_number_of_columns_that_is_not_a_multiple_of_three_raises_an_error(
     self, ):
     with self.assertRaises(ValueError) as err:
         convert(["    ", "   |", "   |", "    "])
     self.assertEqual(type(err.exception), ValueError)
     self.assertEqual(err.exception.args[0],
                      "Number of input columns is not a multiple of three")
Пример #3
0
 def test_recognizes_numbers_separated_by_empty_lines(self):
     input_grid = [
         "    _  _ ", "  | _| _|", "  ||_  _|", "         ", "    _  _ ",
         "|_||_ |_ ", "  | _||_|", "         ", " _  _  _ ", "  ||_||_|",
         "  ||_| _|", "         "
     ]
     self.assertEqual(convert(input_grid), "123,456,789")
Пример #4
0
 def test_garbled_numbers_in_string(self):
     input_grid = [
         "       _     _           _ ",
         "  |  || |  || |     || || |",
         "  |  | _|  ||_|  |  ||_||_|",
         "                           "
     ]
     self.assertEqual(convert(input_grid), "11?10?1?0")
Пример #5
0
 def test_garbled_numbers_in_string(self):
     input_grid = [
         "       _     _           _ ",
         "  |  || |  || |     || || |",
         "  |  | _|  ||_|  |  ||_||_|",
         "                           "
     ]
     self.assertEqual(convert(input_grid), "11?10?1?0")
Пример #6
0
 def test_recognizes_110101100(self):
     input_grid = [
         "       _     _        _  _ ",
         "  |  || |  || |  |  || || |",
         "  |  ||_|  ||_|  |  ||_||_|",
         "                           "
     ]
     self.assertEqual(convert(input_grid), "110101100")
Пример #7
0
 def test_recognizes_string_of_decimal_numbers(self):
     input_grid = [
         "    _  _     _  _  _  _  _  _ ",
         "  | _| _||_||_ |_   ||_||_|| |",
         "  ||_  _|  | _||_|  ||_| _||_|",
         "                              "
     ]
     self.assertEqual(convert(input_grid), "1234567890")
Пример #8
0
 def test_recognizes_110101100(self):
     input_grid = [
         "       _     _        _  _ ",
         "  |  || |  || |  |  || || |",
         "  |  ||_|  ||_|  |  ||_||_|",
         "                           "
     ]
     self.assertEqual(convert(input_grid), "110101100")
Пример #9
0
 def test_recognizes_string_of_decimal_numbers(self):
     input_grid = [
         "    _  _     _  _  _  _  _  _ ",
         "  | _| _||_||_ |_   ||_||_|| |",
         "  ||_  _|  | _||_|  ||_| _||_|",
         "                              "
     ]
     self.assertEqual(convert(input_grid), "1234567890")
Пример #10
0
 def test_recognizes_110101100(self):
     self.assertEqual(
         convert([
             "       _     _        _  _ ",
             "  |  || |  || |  |  || || |",
             "  |  ||_|  ||_|  |  ||_||_|",
             "                           ",
         ]),
         "110101100",
     )
Пример #11
0
 def test_garbled_numbers_in_a_string_are_replaced_with(self):
     self.assertEqual(
         convert([
             "       _     _           _ ",
             "  |  || |  || |     || || |",
             "  |  | _|  ||_|  |  ||_||_|",
             "                           ",
         ]),
         "11?10?1?0",
     )
Пример #12
0
 def test_recognizes_string_of_decimal_numbers(self):
     self.assertEqual(
         convert([
             "    _  _     _  _  _  _  _  _ ",
             "  | _| _||_||_ |_   ||_||_|| |",
             "  ||_  _|  | _||_|  ||_| _||_|",
             "                              ",
         ]),
         "1234567890",
     )
Пример #13
0
 def test_recognizes_numbers_separated_by_empty_lines(self):
     input_grid = [
         "    _  _ ",
         "  | _| _|",
         "  ||_  _|",
         "         ",
         "    _  _ ",
         "|_||_ |_ ",
         "  | _||_|",
         "         ",
         " _  _  _ ",
         "  ||_||_|",
         "  ||_| _|",
         "         "
     ]
     self.assertEqual(convert(input_grid), "123,456,789")
Пример #14
0
 def test_numbers_separated_by_empty_lines_are_recognized_lines_are_joined_by_commas(
         self):
     self.assertEqual(
         convert([
             "    _  _ ",
             "  | _| _|",
             "  ||_  _|",
             "         ",
             "    _  _ ",
             "|_||_ |_ ",
             "  | _||_|",
             "         ",
             " _  _  _ ",
             "  ||_||_|",
             "  ||_| _|",
             "         ",
         ]),
         "123,456,789",
     )
Пример #15
0
 def test_recognizes_0(self):
     self.assertEqual(convert([" _ ",
                               "| |",
                               "|_|",
                               "   "]), '0')
Пример #16
0
 def test_line_number_not_multiple_of_four(self):
     with self.assertRaisesWithMessage(ValueError):
         convert([" _ ",
                  "| |",
                  "   "])
Пример #17
0
 def test_col_number_not_multiple_of_three(self):
     with self.assertRaisesWithMessage(ValueError):
         convert(["    ",
                  "   |",
                  "   |",
                  "    "])
Пример #18
0
 def test_recognizes_4(self):
     self.assertEqual(convert(["   ",
                               "|_|",
                               "  |",
                               "   "]), "4")
Пример #19
0
 def test_recognizes_3(self):
     self.assertEqual(convert([" _ ",
                               " _|",
                               " _|",
                               "   "]), "3")
Пример #20
0
 def test_unreadable(self):
     self.assertEqual(convert(["   ",
                               "  _",
                               "  |",
                               "   "]), '?')
Пример #21
0
 def test_input_with_a_number_of_columns_that_is_not_a_multiple_of_three_raises_an_error(
         self):
     with self.assertRaisesWithMessage(ValueError):
         convert(["    ", "   |", "   |", "    "])
Пример #22
0
 def test_recognizes_6(self):
     self.assertEqual(convert([" _ ",
                               "|_ ",
                               "|_|",
                               "   "]), "6")
Пример #23
0
 def test_line_number_not_multiple_of_four(self):
     with self.assertRaisesWithMessage(ValueError):
         convert([" _ ",
                  "| |",
                  "   "])
Пример #24
0
 def test_recognizes_1(self):
     self.assertEqual(convert(["   ",
                               "  |",
                               "  |",
                               "   "]), '1')
Пример #25
0
 def test_recognizes_0(self):
     self.assertEqual(convert([" _ ",
                               "| |",
                               "|_|",
                               "   "]), '0')
Пример #26
0
 def test_recognizes_7(self):
     self.assertEqual(convert([" _ ",
                               "  |",
                               "  |",
                               "   "]), "7")
Пример #27
0
 def test_unreadable(self):
     self.assertEqual(convert(["   ",
                               "  _",
                               "  |",
                               "   "]), '?')
Пример #28
0
 def test_recognizes_3(self):
     self.assertEqual(convert([" _ ",
                               " _|",
                               " _|",
                               "   "]), "3")
Пример #29
0
 def test_col_number_not_multiple_of_three(self):
     with self.assertRaisesWithMessage(ValueError):
         convert(["    ",
                  "   |",
                  "   |",
                  "    "])
Пример #30
0
 def test_recognizes_6(self):
     self.assertEqual(convert([" _ ",
                               "|_ ",
                               "|_|",
                               "   "]), "6")
Пример #31
0
 def test_unreadable_but_correctly_sized_inputs_return(self):
     self.assertEqual(convert(["   ", "  _", "  |", "   "]), "?")
Пример #32
0
 def test_recognizes_1(self):
     self.assertEqual(convert(["   ",
                               "  |",
                               "  |",
                               "   "]), '1')
Пример #33
0
 def test_recognizes_4(self):
     self.assertEqual(convert(["   ",
                               "|_|",
                               "  |",
                               "   "]), "4")
Пример #34
0
 def test_input_with_a_number_of_lines_that_is_not_a_multiple_of_four_raises_an_error(
         self):
     with self.assertRaisesWithMessage(ValueError):
         convert([" _ ", "| |", "   "])
Пример #35
0
 def test_recognizes_7(self):
     self.assertEqual(convert([" _ ",
                               "  |",
                               "  |",
                               "   "]), "7")
Пример #36
0
 def test_unreadable_but_correctly_sized(self):
     self.assertEqual(convert(["   ",
                               "  _",
                               "  |",
                               "   "]), '?')