def test_parse_checksum_wrong1(self): data = reader.read_scanner_result('../data/checksum_wrong1.txt') ocr_characters = ocr_parser.parse(data) self.assertEqual(9, len(ocr_characters)) account_number = ocr_parser.translate(ocr_characters) self.assertEqual(2, account_number.calculate_checksum()) self.assertEqual('664371495 ERR', str(account_number))
def test_parse_12ERR456709(self): data = reader.read_scanner_result('../data/testcase5.txt') ocr_characters = ocr_parser.parse(data) self.assertEqual(9, len(ocr_characters)) account_number = ocr_parser.translate(ocr_characters) self.assertEqual('12?456709 ILL', str(account_number)) print(f'account number: {account_number}, {account_number!r}')
def test_parse_checksum_ok2(self): data = reader.read_scanner_result('../data/checksum.txt') ocr_characters = ocr_parser.parse(data) self.assertEqual(9, len(ocr_characters)) account_number = ocr_parser.translate(ocr_characters) self.assertEqual(0, account_number.calculate_checksum()) self.assertEqual('457508000', str(account_number))
def test_parse_ones(self): data = reader.read_scanner_result('../data/testcase2.txt') ocr_characters = ocr_parser.parse(data) self.assertEqual(9, len(ocr_characters)) account_number = ocr_parser.translate(ocr_characters) self.assertEqual('111111111 ERR', str(account_number))