Пример #1
0
    def test_int_parser_raises_error(self):
        """
        Tests that the integer parser raises a FieldValueParsingError
        with the correct message if the given string is not an integer.
        """
        with self.assertRaises(FieldValueParsingError) as error:
            FieldValueParsers.int_parser('meh')

        self.assertEqual(
            str(error.exception),
            FieldValueParsers.INVALID_INTEGER_VALUE.format('meh'),
        )
Пример #2
0
 def test_int_parser_returns_int(self):
     """
     Tests that the integer parser parses an integer from a string.
     """
     self.assertEqual(FieldValueParsers.int_parser('4'), 4)