def METHOD_NAME(self):
    value = 'abcd'
    self.validator = HexValidator(max_length=2)
    with self.assertRaises(ValidationError) as err:
        self.validator(value)
    self.assertEqual(str(err.exception), "['Ensure that there are no more than 2 characters.']")
    self.assertEqual(err.exception.code, 'hex_only_max_length')