declearn.test_utils.assert_list_equal
Assert that two (possibly nested) lists are equal.
This function is a more complex equivalent of assert list_a == list_b
that enables comparing numpy array values, and optionally accepting to
cast tuples as lists rather than assert that a tuple and a list are not
equal in any case (even when their contents are the same).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
list_a |
Union[Tuple[Any], List[Any]]
|
First list to compare. |
required |
list_b |
Union[Tuple[Any], List[Any]]
|
Second list to compare. |
required |
strict_tuple |
bool
|
Whether to cast tuples to list prior to comparing them (enabling some tuple-list type differences between the two compared lists). |
False
|
np_tolerance |
Optional[float]
|
Optional absolute tolerance to numpy arrays or float values'
differences (use |
None
|
Raises:
Type | Description |
---|---|
AssertionError
|
If the two lists are not equal. |
Source code in declearn/test_utils/_assertions.py
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 |
|