API Reference

The verify module is composed of various assertion callables (in this case, callable classes) that can be called in two contexts:

  1. By themselves as in Equal(a, b) which will raise an AssertionError if a does not equal b.
  2. In combination with expect() as in expect(a, Equal(b)) which could also raise an AssertionError.

Thus, for all assertion classes below, the value argument defaults to NotSet which is a custom singleton to indicate that nothing was passed in for value. Whether value is set or NotSet is used to indicate which context the assertion class is being used. Whenever value is set, the comparable is swapped with value (internally inside the class’ __init__ method). This allows the assertion to be used in the two contexts above.

This module’s main focus is on testing, which is why all assertions raise an AssertionError on failure. Therefore, all assertion classes function similarly:

  • If the evaluation of value with comparable returns False, then an AssertionError is raised with a custom message.
  • If the evaluation of value with comparable returns True and the class was only created (e.g. Equal(a, b)), then nothing is raised or returned (obviously, since all we did was create a class instance).
  • If the evaluation of value with comparable returns True and the class was called (e.g. expect(a, Equal(b)) or Equal(b)(a)), then True is returned from the class call.

There are two general types of assertions within this module:

  1. Assertions that evaulate a single object: value. Referred to here as a plain assertion.
  2. Assertions that evaulate two objects: value and comparable. Referred to here as a comparator assertion.

When using plain assertions with expect(), you can pass the bare assertion or initialize it.

>>> expect(True, Truthy)
<expect(True)>
>>> expect(True, Truthy())
<expect(True)>

When using any of the assertions, inserting assert in front is optional as each assertion will raise if the evaluation is false. However, having that assert in front may be aesthetically appealing to you, but keep in mind that any assert message included will not be shown since the assertion error will occur within the class itself and raised with it’s own custom error message.

>>> Truthy(True)
<Truthy()>
>>> assert Truthy(True)
# Both of these would raise an assertion error.
>>> Falsy(True)
Traceback (most recent call last):
...
AssertionError: True is not falsy

>>> assert Falsy(True)
Traceback (most recent call last):
...
AssertionError: True is not falsy

# But assert messages will not make it to the traceback.
>>> assert Falsy(True), 'this message will not be shown'
Traceback (most recent call last):
...
AssertionError: True is not falsy

Assertion Runner

The expect class is basically an assertion runner that takes an input value and passes it through any number of assertions or predicate functions. If all assertions pass and return truthy, then all is well and True is returned. Otherwise, either one of the assertion functions will raise an AssertionError or no exceptiosn were raised but at least one of the functions returned a non-truthy value which means that expect() will return False.

The expect has alias in the same module under name of ensure, so you can use both of these names according to your needs.

class verify.runners.expect(value, *assertions)[source]

Pass value through a set of assertable functions.

There are two styles for invoking expect:

  1. Pass value and all assertions as arguments to the __init__ method of expect.
  2. Pass value to the __init__ method of expect and invoke assertions via method chaining.

Examples

Passing value and assertions to expect.__init__:

>>> from verify import *
>>> expect(5, Truthy(), Greater(4))
<expect(5)>
>>> expect(5, Falsy())
Traceback (most recent call last):
...
AssertionError...

Using method chaining:

>>> expect(5).Truthy().Greater(4)
<expect(5)>
>>> expect(5).Falsy()
Traceback (most recent call last):
...
AssertionError...
Parameters:
  • value (mixed) – Value to test.
  • *assertions (callable, optional) – Callable objects that accept value as its first argument. It’s expected that these callables assert something.
Returns:

Allows for method assertion chaining.

Return type:

self

Raises:

AssertionError – If the evaluation of all assertions returns False.

Aliases:
  • ensure

New in version 0.0.1.

    Changed in version 0.1.0:
  • Rename from Expect to expect and change implementation from a class to a function.

  • Passed in value is no longer called if it’s a callable.

  • Return True if all assertions pass.

    Changed in version 0.6.0:
  • Re-implement as class.

  • Support method chaining of assertion classes.

  • Wrap assertions that are not derived from Assertion in Predicate for consistent behavior from external assertion functions.

__getattr__(attr)[source]

Invoke assertions via attribute access. All verify assertions are available.

Assertions

For all assertion classes, the value argument is optional, but when provided the assertion will be evaluated immediately. When passing both the value and comparable arguments, be sure that value comes first even though comparable is listed as the first argument. Internally, when both variables are passed in, value and comparable are swapped in order to support late evaulation, i.e., all of the following are equivalent ways to assert validity:

>>> Less(5, 10)
<Less()>
>>> Less(10)(5)
True
>>> expect(5, Less(10))
<expect(5)>
>>> Truthy(5)
<Truthy()>
>>> Truthy()(5)
True
>>> expect(5, Truthy())
<expect(5)>

Below are the various assertion classes that can be used for validation.

Base Classes

Base classes and mixins.

class verify.base.Assertion(value=NotSet, **opts)[source]

Base class for assertions.

If value is not provided, then assertion isn’t executed. This style of usage is used in conjuction with expect.

If value is provided, then assertion is executed immediately. This style of usage is used when making assertions using only the class and not an assertion runner like expect.

Keyword Arguments:
 msg (str, optional) – Override assert message to use when performing assertion.
__call__(*args, **opts)[source]

Execute validation.

Keyword Arguments:
 msg (str, optional) – Override assert message to use when performing assertion.
Returns:True if comparison passes, otherwise, an AssertionError is raised.
Return type:bool
Raises:AssertionError – If comparison returns False.
format_msg(*args, **kargs)[source]

Return formatted assert message. This is used to generate the assert message during __call__(). If no msg keyword argument is provided, then reason will be used as the format string. By default, passed in args and kargs along with the classes __dict__ dictionary are given to the format string. In all cases, arg[0] will be the value that is being validated.

op = None

Operation to perform to determine whether value is valid. This must be set in subclass.

reason = ''

Default format string used for assert message.

class verify.base.Comparator(comparable, value=NotSet, **opts)[source]

Base class for assertions that compare two values.

class verify.base.Negate[source]

Mixin class that negates the results of compare() from the parent class.

verify.base.NotSet = NotSet

Singleton to indicate that a keyword argument was not provided.

verify.base.is_assertion(obj)[source]

Return whether obj is either an instance or subclass of Assertion.

Logic

Assertions related to logical operations.

class verify.logic.Truthy(value=NotSet, **opts)[source]

Asserts that value is truthy.

Aliases:
  • to_be_truthy
  • is_truthy

New in version 0.0.1.

reason = '{0} is not truthy'
class verify.logic.Falsy(value=NotSet, **opts)[source]

Asserts that value is falsy.

Aliases:
  • to_be_falsy
  • is_falsy

New in version 0.0.1.

reason = '{0} is not falsy'
class verify.logic.Not(comparable, value=NotSet, **opts)[source]

Asserts that comparable doesn’t raise an AssertionError. Can be used to create “opposite” comparators.

Examples

>>> from verify import *
>>> expect(5, Not(In([1, 2, 3])))
<expect(5)>
>>> Not(5, In([1, 2, 3]))
<Not()>
>>> Not(In([1, 2, 3]))(5)
True
Aliases:
  • not_
  • does_not
  • to_fail
  • fails

New in version 0.0.1.

reason = 'The negation of {comparable} should not be true when evaluated with {0}'
class verify.logic.Predicate(comparable, value=NotSet, **opts)[source]

Asserts that value evaluated by the predicate comparable is True.

Aliases:
  • does
  • to_pass
  • passes

New in version 0.1.0.

Changed in version 0.6.0: Catch AssertionError thrown by comparable and return False as comparison value instead.

reason = 'The evaluation of {0} using {comparable} is false'
class verify.logic.All(comparable, value=NotSet, **opts)[source]

Asserts that value evaluates as truthy for all predicates in comparable.

Aliases:
  • all_
  • does_all
  • passes_all

New in version 0.2.0.

reason = '{0} is not true for all {comparable}'
class verify.logic.NotAll(comparable, value=NotSet, **opts)[source]

Asserts that value evaluates as falsy for all predicates in comparable.

Aliases:
  • to_be_not_all
  • does_not_all
  • fails_all

New in version 0.5.0.

reason = '{0} is true for all {comparable}'
class verify.logic.Any(comparable, value=NotSet, **opts)[source]

Asserts that value evaluates as truthy for any predicates in comparable.

Aliases:
  • any_
  • does_any
  • passes_any

New in version 0.2.0.

reason = '{0} is not true for any {comparable}'
class verify.logic.NotAny(comparable, value=NotSet, **opts)[source]

Asserts that value evaluates as falsy for any predicates in comparable.

Aliases:
  • not_any
  • does_not_any
  • fails_any

New in version 0.5.0.

reason = '{0} is true for some {comparable}'

Equality

Assertions related to equality.

class verify.equality.Equal(comparable, value=NotSet, **opts)[source]

Asserts that two values are equal.

Aliases:
  • to_be_equal
  • is_equal

New in version 0.0.1.

reason = '{0} is not equal to {comparable}'
class verify.equality.NotEqual(comparable, value=NotSet, **opts)[source]

Asserts that two values are not equal.

Aliases:
  • to_not_be_equal
  • is_not_equal

New in version 0.5.0.

reason = '{0} is equal to {comparable}'
class verify.equality.Match(comparable, value=NotSet, **opts)[source]

Asserts that value matches the regular expression comparable.

Parameters:
  • value (mixed, optional) – Value to compare.
  • comparable (str|RegExp) – String or RegExp object used for matching.
Keyword Arguments:
 

flags (int, optional) – Used when compiling regular expression when regular expression is a string. Defaults to 0.

Aliases:
  • to_match
  • is_match
  • matches

New in version 0.3.0.

reason = '{0} does not match the regular expression {comparable}'
class verify.equality.NotMatch(comparable, value=NotSet, **opts)[source]

Asserts that value does not match the regular expression comparable.

Aliases:
  • to_not_be_match
  • is_not_match
  • not_matches

New in version 0.5.0.

reason = '{0} matches the regular expression {comparable}'
class verify.equality.Is(comparable, value=NotSet, **opts)[source]

Asserts that value is comparable.

Aliases:
  • to_be
  • is_

New in version 0.0.1.

reason = '{0} is not {comparable}'
class verify.equality.IsNot(comparable, value=NotSet, **opts)[source]

Asserts that value is not comparable.

Aliases:
  • to_not_be
  • is_not

New in version 0.5.0.

reason = '{0} is {comparable}'
class verify.equality.IsTrue(value=NotSet, **opts)[source]

Asserts that value is True.

Aliases:
  • to_be_true
  • is_true

New in version 0.1.0.

reason = '{0} is not True'
class verify.equality.IsNotTrue(value=NotSet, **opts)[source]

Asserts that value is not True.

Aliases:
  • to_not_be_true
  • is_not_true

New in version 0.5.0.

reason = '{0} is True'
class verify.equality.IsFalse(value=NotSet, **opts)[source]

Asserts that value is False.

Aliases:
  • to_be_false
  • is_false

New in version 0.1.0.

reason = '{0} is not False'
class verify.equality.IsNotFalse(value=NotSet, **opts)[source]

Asserts that value is not False.

Aliases:
  • to_not_be_false
  • is_not_false

New in version 0.5.0.

reason = '{0} is False'
class verify.equality.IsNotNone(value=NotSet, **opts)[source]

Asserts that value is not None.

Aliases:
  • to_be_not_none
  • is_not_none

New in version 0.5.0.

reason = '{0} is None'
class verify.equality.IsNone(value=NotSet, **opts)[source]

Asserts that value is None.

Aliases:
  • to_be_none
  • is_none

New in version 0.0.1.

reason = '{0} is not None'

Types

Assertions related to types.

class verify.types.Type(comparable, value=NotSet, **opts)[source]

Asserts that value is an instance of comparable.

Aliases:
  • to_be_type
  • is_type

New in version 0.0.1.

Changed in version 0.6.0: Renamed from InstanceOf to Type

reason = '{0} is not an instance of {comparable}'
class verify.types.NotType(comparable, value=NotSet, **opts)[source]

Asserts that value is a not an instance of comparable.

Aliases:
  • to_be_not_type
  • is_not_type

New in version 0.5.0.

Changed in version 0.6.0: Renamed from NotInstanceOf to NotType

reason = '{0} is an instance of {comparable}'
class verify.types.Boolean(value=NotSet, **opts)[source]

Asserts that value is a boolean.

Aliases:
  • to_be_boolean
  • is_boolean

New in version 0.1.0.

reason = '{0} is not a boolean'
class verify.types.NotBoolean(value=NotSet, **opts)[source]

Asserts that value is a not a boolean.

Aliases:
  • to_be_not_boolean
  • is_not_boolean

New in version 0.5.0.

reason = '{0} is a boolean'
class verify.types.String(value=NotSet, **opts)[source]

Asserts that value is a string (str or unicode on Python 2).

Aliases:
  • to_be_string
  • is_string

New in version 0.1.0.

reason = '{0} is not a string'
class verify.types.NotString(value=NotSet, **opts)[source]

Asserts that value is a not a string.

Aliases:
  • to_be_not_string
  • is_not_string

New in version 0.5.0.

reason = '{0} is a string'
class verify.types.Dict(value=NotSet, **opts)[source]

Asserts that value is a dictionary.

Aliases:
  • to_be_dict
  • is_dict

New in version 0.1.0.

reason = '{0} is not a dictionary'
class verify.types.NotDict(value=NotSet, **opts)[source]

Asserts that value is a not a dict.

Aliases:
  • to_be_not_dict
  • is_dict

New in version 0.5.0.

reason = '{0} is a dict'
class verify.types.List(value=NotSet, **opts)[source]

Asserts that value is a list.

Aliases:
  • to_be_list
  • is_list

New in version 0.1.0.

reason = '{0} is not a list'
class verify.types.NotList(value=NotSet, **opts)[source]

Asserts that value is a not a list.

Aliases:
  • to_be_not_list
  • is_not_list

New in version 0.5.0.

reason = '{0} is a list'
class verify.types.Tuple(value=NotSet, **opts)[source]

Asserts that value is a tuple.

Aliases:
  • to_be_tuple
  • is_tuple

New in version 0.1.0.

reason = '{0} is not a tuple'
class verify.types.NotTuple(value=NotSet, **opts)[source]

Asserts that value is a not a tuple.

Aliases:
  • to_be_not_tuple
  • is_not_tuple

New in version 0.5.0.

reason = '{0} is a tuple'
class verify.types.Date(value=NotSet, **opts)[source]

Asserts that value is an instance of datetime.date or datetime.datetime.

Aliases:
  • to_be_date
  • is_date

New in version 0.3.0.

reason = '{0} is not a date or datetime object'
class verify.types.NotDate(value=NotSet, **opts)[source]

Asserts that value is a not a date or datetime object.

Aliases:
  • to_be_not_date
  • is_not_date

New in version 0.5.0.

reason = '{0} is a date or datetime object'
class verify.types.DateString(comparable, value=NotSet, **opts)[source]

Asserts that value is matches the datetime format string comparable.

Aliases:
  • to_be_date_string
  • is_date_string

New in version 0.3.0.

reason = '{0} does not match the datetime format {comparable}'
class verify.types.NotDateString(comparable, value=NotSet, **opts)[source]

Asserts that value does not match datetime format string comparable.

Aliases:
  • to_be_not_date_string
  • is_not_date_string

New in version 0.5.0.

reason = '{0} matches the datetime format {comparable}'
class verify.types.Int(value=NotSet, **opts)[source]

Asserts that value is an integer.

Aliases:
  • to_be_int
  • is_int

New in version 0.1.0.

reason = '{0} is not an integer'
class verify.types.NotInt(value=NotSet, **opts)[source]

Asserts that value is a not an integer.

Aliases:
  • to_be_not_int
  • is_not_int

New in version 0.5.0.

reason = '{0} is an integer'
class verify.types.NotFloat(value=NotSet, **opts)[source]

Asserts that value is a not a float.

Aliases:
  • to_be_not_float
  • is_not_float

New in version 0.5.0.

reason = '{0} is a float'
class verify.types.Float(value=NotSet, **opts)[source]

Asserts that value is a float.

Aliases:
  • to_be_float
  • is_float

New in version 0.1.0.

reason = '{0} is not a float'
class verify.types.Number(value=NotSet, **opts)[source]

Asserts that value is a number.

Objects considered a number are:

  • int
  • float
  • decimal.Decimal
  • long (Python 2)
Aliases:
  • to_be_number
  • is_number

New in version 0.1.0.

reason = '{0} is not a number'
class verify.types.NotNumber(value=NotSet, **opts)[source]

Asserts that value is a not a number.

Aliases:
  • to_be_not_number
  • is_not_number

New in version 0.1.0.

Changed in version 0.5.0: Renamed from NaN to NotNumber.

reason = '{0} is a number'

Containers

Assertions related to containers/iterables.

class verify.containers.In(comparable, value=NotSet, **opts)[source]

Asserts that value is in comparable.

Aliases:
  • to_be_in
  • is_in

New in version 0.0.1.

reason = '{0} is not in {comparable}'
class verify.containers.NotIn(comparable, value=NotSet, **opts)[source]

Asserts that value is not in comparable.

Aliases:
  • to_not_be_in
  • is_not_in

New in version 0.5.0.

reason = '{0} is in {comparable}'
class verify.containers.Contains(comparable, value=NotSet, **opts)[source]

Asserts that value is an iterable and contains comparable.

Aliases:
  • to_contain
  • contains

New in version 0.2.0.

reason = '{0} does not contain {comparable}'
class verify.containers.NotContains(comparable, value=NotSet, **opts)[source]

Asserts that value does not contain comparable.

Aliases:
  • to_not_contain
  • does_not_contain

New in version 0.5.0.

reason = '{0} contains {comparable}'
class verify.containers.ContainsOnly(comparable, value=NotSet, **opts)[source]

Asserts that value is an iterable and only contains comparable.

Aliases:
  • to_contain_only
  • contains_only

New in version 0.2.0.

reason = '{0} does not only contain values in {comparable}'
class verify.containers.NotContainsOnly(comparable, value=NotSet, **opts)[source]

Asserts that value does not contain only comparable.

Aliases:
  • to_not_contain_only
  • does_not_contain_only

New in version 0.5.0.

reason = '{0} contains only {comparable}'
class verify.containers.Subset(comparable, value=NotSet, **opts)[source]

Asserts that value is a subset of comparable. Comparison supports nested dict, list, and tuple objects.

Aliases:
  • to_be_subset
  • is_subset

New in version 0.3.0.

reason = '{0} is not a subset of {comparable}'
class verify.containers.NotSubset(comparable, value=NotSet, **opts)[source]

Asserts that value is a not a subset of comparable.

Aliases:
  • to_not_be_subset
  • is_not_subset

New in version 0.5.0.

reason = '{0} is a subset of {comparable}'
class verify.containers.Superset(comparable, value=NotSet, **opts)[source]

Asserts that value is a superset of comparable. Comparison supports nested dict, list, and tuple objects.

Aliases:
  • to_be_superset
  • is_superset

New in version 0.3.0.

reason = '{0} is not a supserset of {comparable}'
class verify.containers.NotSuperset(comparable, value=NotSet, **opts)[source]

Asserts that value is a not a superset of comparable.

Aliases:
  • to_not_be_superset
  • is_not_superset

New in version 0.5.0.

reason = '{0} is a superset of {comparable}'
class verify.containers.Unique(value=NotSet, **opts)[source]

Asserts that value contains only unique values. If value is a dict, then its values() will be compared.

Aliases:
  • to_be_unique
  • is_unique

New in version 0.3.0.

reason = '{0} contains duplicate items'
class verify.containers.NotUnique(value=NotSet, **opts)[source]

Asserts that value is a not a unique.

Aliases:
  • to_not_be_unique
  • is_not_unique

New in version 0.5.0.

reason = '{0} is unique'
class verify.containers.Length(value=NotSet, **opts)[source]

Asserts that value is an iterable with length between min and max inclusively.

Examples

These will pass:

>>> assert Length([1, 2, 3], min=3, max=3)  # 3 <= len(a) <= 3
>>> assert Length([1, 2, 3, 4, 5], min=5, max=6)  # 5 <= len(a) <= 6
>>> assert Length([1, 2, 3], max=6)  # len(a) <= 6
>>> assert Length([1, 2, 3, 4], min=4)  # len(a) >= 4

This will fail:

>>> Length([1, 2, 4], max=2)  # len(a) <= 2
Traceback (most recent call last):
...
AssertionError...
Parameters:

value (mixed, optional) – Value to compare.

Keyword Arguments:
 
  • min (int, optional) – Minimum value that value must be greater than or equal to.
  • max (int, optional) – Maximum value that value must be less than or equal to.
Aliases:
  • to_have_length
  • has_length

New in version 0.2.0.

    Changed in version 0.4.0:
  • Change comparison to function like Between meaning length is compared to min and max values.

  • Allow keyword arguments min and max to be used in place of positional tuple

Changed in version 1.0.0: Removed positional tuple argument and only support min and max keyword arguments.

reason = '{0} does not have length between {min} and {max}'
class verify.containers.NotLength(value=NotSet, **opts)[source]

Asserts that value is an iterable with length not between min and max inclusively.

Aliases:
  • to_not_have_length
  • does_not_have_length

New in version 1.0.0.

reason = '{0} has length between {min} and {max}'

Numbers

Assertions related to numbers.

class verify.numbers.Greater(comparable, value=NotSet, **opts)[source]

Asserts that value is greater than comparable.

Aliases:
  • GreaterThan
  • to_be_greater
  • to_be_greater_than
  • is_greater
  • is_greater_than

New in version 0.0.1.

reason = '{0} is not greater than {comparable}'
verify.numbers.GreaterThan

alias of Greater

class verify.numbers.GreaterEqual(comparable, value=NotSet, **opts)[source]

Asserts that value is greater than or equal to comparable.

Aliases:
  • GreaterThanEqual
  • to_be_greater_equal
  • to_be_greater_or_equal
  • is_greater_equal
  • is_greater_or_equal

New in version 0.0.1.

reason = '{0} is not greater than or equal to {comparable}'
verify.numbers.GreaterOrEqual

alias of GreaterEqual

class verify.numbers.Less(comparable, value=NotSet, **opts)[source]

Asserts that value is less than comparable.

Aliases:
  • LessThan
  • to_be_less
  • to_be_less_than
  • is_less
  • is_less_than

New in version 0.0.1.

reason = '{0} is not less than {comparable}'
verify.numbers.LessThan

alias of Less

class verify.numbers.LessEqual(comparable, value=NotSet, **opts)[source]

Asserts that value is less than or equal to comparable.

Aliases:
  • LessThanEqual
  • to_be_less_equal
  • to_be_less_or_equal
  • is_less_equal
  • is_less_or_equal

New in version 0.0.1.

reason = '{0} is not less than or equal to {comparable}'
verify.numbers.LessOrEqual

alias of LessEqual

class verify.numbers.Between(value=NotSet, **opts)[source]

Asserts that value is between min and max inclusively.

Examples

These will pass:

>>> assert Between(5, min=4, max=6)  # 4 <= 5 <= 6
>>> assert Between(5, min=5, max=6)  # 5 <= 5 <= 6
>>> assert Between(5, max=6)  # 5 <= 6
>>> assert Between(5, min=4)  # 5 >= 4

This will fail:

>>> Between(5, max=4)  # 5 <= 4
Traceback (most recent call last):
...
AssertionError...
Parameters:

value (mixed, optional) – Value to compare.

Keyword Arguments:
 
  • min (int, optional) – Minimum value that value must be greater than or equal to.
  • max (int, optional) – Maximum value that value must be less than or equal to.
Aliases:
  • to_be_between
  • is_between

New in version 0.2.0.

Changed in version 0.4.0: Allow keyword arguments min and max to be used in place of positional tuple.

Changed in version 1.0.0: Removed positional tuple argument and only support min and max keyword arguments.

reason = '{0} is not between {min} and {max}'
class verify.numbers.NotBetween(value=NotSet, **opts)[source]

Asserts that value is not between min and max inclusively.

Aliases:
  • to_not_be_between
  • is_not_between

New in version 0.5.0.

reason = '{0} is between {min} and {max}'
class verify.numbers.Positive(value=NotSet, **opts)[source]

Asserts that value is a positive number.

Aliases:
  • to_be_positive
  • is_positive

New in version 0.3.0.

reason = '{0} is not a positive number'
class verify.numbers.Negative(value=NotSet, **opts)[source]

Asserts that value is a negative number.

Aliases:
  • to_be_negative
  • is_negative

New in version 0.3.0.

reason = '{0} is not a negative number'
class verify.numbers.Even(value=NotSet, **opts)[source]

Asserts that value is an even number.

Aliases:
  • to_be_even
  • is_even

New in version 0.3.0.

reason = '{0} is not an even number'
class verify.numbers.Odd(value=NotSet, **opts)[source]

Asserts that value is an odd number.

Aliases:
  • to_be_odd
  • is_odd

New in version 0.3.0.

reason = '{0} is not an odd number'
class verify.numbers.Monotone(comparable, value=NotSet, **opts)[source]

Asserts that value is a monotonic with respect to comparable.

Aliases:
  • to_be_monotone
  • is_monotone

New in version 0.3.0.

reason = '{0} is not monotonic as evaluated by {comparable}'
class verify.numbers.Increasing(value=NotSet, **opts)[source]

Asserts that value is monotonically increasing.

Aliases:
  • to_be_increasing
  • is_increasing

New in version 0.3.0.

reason = '{0} is not monotonically increasing'
class verify.numbers.StrictlyIncreasing(value=NotSet, **opts)[source]

Asserts that value is strictly increasing.

Aliases:
  • to_be_strictly_increasing
  • is_strictly_increasing

New in version 0.3.0.

reason = '{0} is not strictly increasing'
class verify.numbers.Decreasing(value=NotSet, **opts)[source]

Asserts that value is monotonically decreasing.

Aliases:
  • to_be_decreasing
  • is_decreasing

New in version 0.3.0.

reason = '{0} is not monotonically decreasing'
class verify.numbers.StrictlyDecreasing(value=NotSet, **opts)[source]

Asserts that value is strictly decreasing.

Aliases:
  • to_be_strictly_decreasing
  • is_strictly_decreasing

New in version 0.3.0.

reason = '{0} is not strictly decreasing'