Deepwalker / trafaret

Ultimate transformation library that supports validation, contexts and aiohttp.
http://trafaret.readthedocs.org/en/latest/
BSD 2-Clause "Simplified" License
177 stars 31 forks source link

Add to documentation way to set range validation in numerical data types #82

Closed Arfey closed 5 years ago

Arfey commented 5 years ago

In version2 (branch) u need to add a part that describe set range validation in numerical data types. I think that it can be just documentation with Int checker but in brackets u need to say that it is avalivle to all numerical checkers.

For that u can use tests which connected with current part or source code.

    >>> Int[1:]
    <Int(gte=1)>
    >>> Int[1:10]
    <Int(gte=1, lte=10)>
    >>> Int[:10]
    <Int(lte=10)>
    >>> Float[1:]
    <Float(gte=1)>
    >>> Int > 3
    <Int(gt=3)>
    >>> 1 < (Float < 10)
    <Float(gt=1, lt=10)>
    >>> (Int > 5).check(10)
    10

As example u can use this PR.

Please don't forget: