algebraixlib.util.test module¶
Test utilities.
-
algebraixlib.util.test.create_test_object(obj: object, msg: str, val: object = None) → object[source]¶ Add the content of
msgand optionallyvalas properties toobj.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
Trueif and only if all elements inmoare instances ofMathObject.
-
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_modulefile’s base name with an appended dash (‘-‘) and an identifyingfile_id.file_idshould end with the desired file extension.Parameters: - test_module – The name of the test to which the test file belongs. Typically
this will be passed as
__file__. - file_id – The identification of the file (final part of the name, including extension). This function guarantees that there are no conflicts with outher test modules.
- test_module – The name of the test to which the test file belongs. Typically
this will be passed as
-
algebraixlib.util.test.get_test_file_path(test_module: str, file_id: str) → str[source]¶ Return the (absolute) file path of a test file.
The file name is generated with
get_test_file_name.Parameters: - test_module – The name of the test to which the test file belongs. Typically
this will be passed as
__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 passed as