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: 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: ndarray[Any, Any] | 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: Iterable[Hashable], b: Iterable[Hashable], /) bool [source]
Check if a has no elements in b.
- assertionlib.assertion_functions.issuperset(a: Iterable[Hashable], b: Iterable[Hashable], /) bool [source]
Check if a contains all elements from b.
- assertionlib.assertion_functions.issubset(a: Iterable[Hashable], b: Iterable[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.