Пример #1
0
def test_validate_ci_raises_ValueError(input):
    """
    Validates that validate_ci raises ValueError if the input is not within
    the valid range.
    """
    with pytest.raises(ValueError):
        ciuy.validate_ci(input)
Пример #2
0
def cmd_validate_ci():
    parser = argparse.ArgumentParser(
        description='Validate Uruguayan identity document numbers.')
    parser.add_argument('ci', help='Document number to validate.')
    args = parser.parse_args()

    try:
        result = ciuy.validate_ci(args.ci)
    except ValueError as err:
        result = "Error: {0}".format(err)
    print(result, end="")
Пример #3
0
def test_validate_ci_number_false(input):
    """
    Validates that validate_ci returns False if the input is not a valid ci,
    when the input is a number with some non digit characters.
    """
    assert not ciuy.validate_ci(input)
Пример #4
0
def test_validate_ci_string_clean_true(input):
    """
    Validates that validate_ci returns True if the input is a valid ci,
    when the input is a string without any non digit characters.
    """
    assert ciuy.validate_ci(input)
Пример #5
0
def test_validate_ci_number_true(input):
    """
    Validates that validate_ci returns True if the input is a valid ci,
    when the input is a number.
    """
    assert ciuy.validate_ci(input)
Пример #6
0
def test_validate_ci_string_dirty_true(input):
    """
    Validates that validate_ci returns true if the input is a valid ci,
    when the input is a string with some non digit characters.
    """
    assert ciuy.validate_ci(input)