Did I find the right examples for you? yes no

All Samples(6)  |  Call(4)  |  Derive(0)  |  Import(2)

        def valid_non_negative_integer(val):
    try:
        integer = int(val)
    except ValueError:
        raise NotValid("non negative integer")
        
    if integer < 0:
        raise NotValid("non negative integer")
    return True
        


src/p/y/pysaml2-2.0.0/tests/test_13_validate.py   pysaml2(Download)
from saml2.validate import valid_duration, MustValueError
from saml2.validate import valid_unsigned_short
from saml2.validate import valid_non_negative_integer
from saml2.validate import valid_string
from saml2.validate import valid_instance
def test_valid_non_negative_integer():
    assert valid_non_negative_integer("1234567890")
 
    raises( NotValid, 'valid_non_negative_integer("-123")')
    raises( NotValid, 'valid_non_negative_integer("123.56")')
    assert valid_non_negative_integer("12345678901234567890")

src/p/y/pysaml2-HEAD/tests/test_13_validate.py   pysaml2(Download)
from saml2.validate import valid_duration, MustValueError
from saml2.validate import valid_unsigned_short
from saml2.validate import valid_non_negative_integer
from saml2.validate import valid_string
from saml2.validate import valid_instance
def test_valid_non_negative_integer():
    assert valid_non_negative_integer("1234567890")
 
    raises(NotValid, 'valid_non_negative_integer("-123")')
    raises(NotValid, 'valid_non_negative_integer("123.56")')
    assert valid_non_negative_integer("12345678901234567890")