def test_validation_digit_raises_ValueError(input): """ Validates that validation_digit raises ValueError if the input is not within the valid range. """ with pytest.raises(ValueError): ciuy.validation_digit(input)
def cmd_validation_digit(): parser = argparse.ArgumentParser( description='Validate Uruguayan identity document numbers.') parser.add_argument( 'ci', help='Document number for which you want to find the validation digit.' ) args = parser.parse_args() try: result = ciuy.validation_digit(args.ci) except ValueError as err: result = "Error: {0}".format(err) print(result, end="")
def test_validation_digit_string_clean(input, expected): """ Validates that validation_digit returns the correct digit, when the input is a string without any non digit characters. """ assert ciuy.validation_digit(input) == expected
def test_validation_digit_number(input, expected): """ Validates that validation_digit returns the correct digit, when the input is a number. """ assert ciuy.validation_digit(input) == expected