.. _f-unittestclass: module ``pycode.unittestclass`` =============================== .. inheritance-diagram:: pyquickhelper.pycode.unittestclass Short summary +++++++++++++ module ``pyquickhelper.pycode.unittestclass`` Overwrites unit test class with additional testing functions. :githublink:`%|py|5` Classes +++++++ +-----------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------+ | class | truncated documentation | +=======================================================================+===========================================================================================================================+ | :class:`ExtTestCase ` | Overwrites unit test class with additional testing functions. Unless *setUp* is overwritten, warnings *FutureWarning* ... | +-----------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------+ Functions +++++++++ +--------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------+ | function | truncated documentation | +========================================================================================================+==================================================================================================+ | :func:`assert_almost_equal_detailed ` | Calls :epkg:`numpy:testing:assert_almost_equal`. Add more informations in the exception message. | +--------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------+ | :func:`ignore_warnings ` | Catches warnings. | +--------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------+ | :func:`skipif_appveyor ` | Skips a unit test if it runs on :epkg:`appveyor`. | +--------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------+ | :func:`skipif_azure ` | Skips a unit test if it runs on :epkg:`azure pipeline`. | +--------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------+ | :func:`skipif_azure_linux ` | Skips a unit test if it runs on :epkg:`azure pipeline` on :epkg:`linux`. | +--------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------+ | :func:`skipif_azure_macosx ` | Skips a unit test if it runs on :epkg:`azure pipeline` on :epkg:`linux`. | +--------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------+ | :func:`skipif_circleci ` | Skips a unit test if it runs on :epkg:`circleci`. | +--------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------+ | :func:`skipif_linux ` | Skips a unit test if it runs on :epkg:`linux`. | +--------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------+ | :func:`skipif_travis ` | Skips a unit test if it runs on :epkg:`travis`. | +--------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------+ | :func:`skipif_vless ` | Skips a unit test if the version is stricly below *version* (tuple). | +--------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------+ | :func:`testlog ` | Logs before and after a function is called. | +--------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------+ | :func:`unittest_require_at_least ` | Skips a unit test if the version of one module is not at least the provided version. | +--------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------+ Static Methods ++++++++++++++ +--------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------+ | staticmethod | truncated documentation | +======================================================================================+==============================================================================================================+ | :py:meth:`_format_str ` | Returns ``s`` or ``'s'`` depending on the type. | +--------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------+ | :meth:`abs_path_join ` | Returns an absolute and normalized path from this location. | +--------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------+ | :meth:`profile ` | Profiles the execution of a function with function :func:`profile `. | +--------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------+ | :meth:`setUpClass ` | Filters out *FutureWarning*, *PendingDeprecationWarning*. | +--------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------+ | :meth:`tearDownClass ` | Stops filtering out *FutureWarning*, *PendingDeprecationWarning*. | +--------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------+ Methods +++++++ +----------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------+ | method | truncated documentation | +==========================================================================================================+============================================================================================+ | :meth:`assertCallable ` | Checks that *fct* is callable. | +----------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------+ | :meth:`assertEmpty ` | Checks that *x* is empty. | +----------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------+ | :meth:`assertEndsWith ` | Checks that string *sub* ends with *whole*. | +----------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------+ | :meth:`assertEqual ` | Checks that ``a == b``. | +----------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------+ | :meth:`assertEqualArray ` | Checks that two arrays are equal. Relies on :epkg:`numpy:testing:assert_almost_equal`. | +----------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------+ | :meth:`assertEqualDataFrame ` | Checks that two dataframes are equal. Calls :epkg:`pandas:testing:assert_frame_equal`. | +----------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------+ | :meth:`assertEqualDict ` | Checks that ``a == b``. | +----------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------+ | :meth:`assertEqualFloat ` | Checks that ``abs(a-b) < precision``. | +----------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------+ | :meth:`assertEqualNumber ` | Checks that two numbers are equal. | +----------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------+ | :meth:`assertEqualSparseArray ` | | +----------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------+ | :meth:`assertExists ` | Checks that *name* exists. | +----------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------+ | :meth:`assertGreater ` | Checks that ``x >= y``. | +----------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------+ | :meth:`assertHasNoNan ` | Checks that there is no NaN in ``a``. | +----------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------+ | :meth:`assertIn ` | Checks that substring *sub* is in *text*. | +----------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------+ | :meth:`assertLesser ` | Checks that ``x <= y``. | +----------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------+ | :meth:`assertLogging ` | Returns the logged information in a logger defined by its name. | +----------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------+ | :meth:`assertNotEmpty ` | Checks that *x* is not empty. | +----------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------+ | :meth:`assertNotEndsWith ` | Checks that string *sub* does not end with *whole*. | +----------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------+ | :meth:`assertNotEqual ` | Checks that ``a != b``. | +----------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------+ | :meth:`assertNotEqualArray ` | Checks that two arrays are equal. Relies on :epkg:`numpy:testing:assert_almost_equal`. | +----------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------+ | :meth:`assertNotEqualDataFrame ` | Checks that two dataframes are different. Calls :epkg:`pandas:testing:assert_frame_equal`. | +----------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------+ | :meth:`assertNotExists ` | Checks that *name* does not exist. | +----------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------+ | :meth:`assertNotStartsWith ` | Checks that string *sub* does not start with *whole*. | +----------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------+ | :meth:`assertRaise ` | Checks that function *fct* with no parameter raises an exception of a given type. | +----------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------+ | :meth:`assertStartsWith ` | Checks that string *sub* starts with *whole*. | +----------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------+ | :meth:`assertWarning ` | Returns the list of warnings raised while executing function *fct*. | +----------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------+ | :meth:`capture ` | Runs a function and capture standard output and error. | +----------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------+ | :meth:`fLOG ` | Prints out some information. :func:`fLOG`. | +----------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------+ | :meth:`read_file ` | Returns the content of a file. | +----------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------+ | :meth:`write_file ` | Writes the content of a file. | +----------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------+ Documentation +++++++++++++ .. automodule:: pyquickhelper.pycode.unittestclass :members: :special-members: __init__ :show-inheritance: