assertionlib.assertion_functions
A module with various new assertion functions.
Index
|
Check if the length of a is equivalent to b: |
|
Check if the string-representation of a is equivalent to b: |
|
Check if the shapes of a and b are equivalent: |
|
Check if a has no elements in b. |
|
Check if a contains all elements from b. |
|
Check if b contains all elements in a. |
|
Check if two functions are equivalent by checking if their |
API
- assertionlib.assertion_functions.len_eq(a: ~typing.Sized, b: int, /) bool [source]
Check if the length of a is equivalent to b:
len(a) == b
.
- assertionlib.assertion_functions.str_eq(a: ~assertionlib.assertion_functions.T, b: str, /, *, str_converter: ~typing.Callable[[~assertionlib.assertion_functions.T], str] = <built-in function repr>) bool [source]
Check if the string-representation of a is equivalent to b:
repr(a) == b
.
- assertionlib.assertion_functions.shape_eq(a: ndarray[Any, Any], b: ~typing.Union[ndarray[Any, Any], ~typing.Tuple[int, ...]], /) bool [source]
Check if the shapes of a and b are equivalent:
a.shape == getattr(b, 'shape', b)
.b should be either an object with the
shape
attribute (e.g. a NumPy array) or atuple
representing a valid array shape.
- assertionlib.assertion_functions.isdisjoint(a: ~typing.Iterable[~typing.Hashable], b: ~typing.Iterable[~typing.Hashable], /) bool [source]
Check if a has no elements in b.
- assertionlib.assertion_functions.issuperset(a: ~typing.Iterable[~typing.Hashable], b: ~typing.Iterable[~typing.Hashable], /) bool [source]
Check if a contains all elements from b.
- assertionlib.assertion_functions.issubset(a: ~typing.Iterable[~typing.Hashable], b: ~typing.Iterable[~typing.Hashable], /) bool [source]
Check if b contains all elements in a.
- assertionlib.assertion_functions.function_eq(func1: function, func2: function, /) bool [source]
Check if two functions are equivalent by checking if their
__code__
is identical.func1 and func2 should be instances of
FunctionType
or any other object with access to the__code__
attribute.