algebraixlib.util.test module¶
Addition to unittest to be able to create non-failing ‘expect’-like tests.
-
algebraixlib.util.test.
create_test_object
(obj: object, msg: str, val: object=None) → object[source]¶ Add the content of msg and optionally val as properties to obj.
Parameters: - obj – The object to be ‘decorated’.
- msg – Added as property ‘_test_msg’ to obj.
- val – If present, added as property ‘_test_val’ to obj.
Returns: The ‘decorated’ obj.
-
algebraixlib.util.test.
assert_mathobjects
(mo: algebraixlib.mathobjects.mathobject.MathObject) → bool[source]¶ Return True if and only if all elements in mo are instances of MathObject.
-
algebraixlib.util.test.
get_test_file_name
(test_module: str, file_id: str) → str[source]¶ Return the file name of a test file.
Test file names are composed of the test test_module file’s base name with an appended dash (‘-‘) and an identifying
file_id
.file_id
should end with the desired file extension.Parameters: - test_module – The name of the test to which the test file belongs. Typically
this will be
__file__
. - file_id – The identification of the file (final part of the name, including extension).
- test_module – The name of the test to which the test file belongs. Typically
this will be
-
algebraixlib.util.test.
get_test_file_path
(test_module: str, file_id: str) → str[source]¶ Return the (absolute) file path of a test file. Test file names are composed
Parameters: - test_module – The name of the test test_module to which the test file belongs. Typically
this will be
__file__
. - file_id – The identification of the file (final part of the name, including extension).
- test_module – The name of the test test_module to which the test file belongs. Typically
this will be