.. _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:`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:`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. | +-------------------------------------------------------------------------------------+-------------------------------------------------+ 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.html`. | +----------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------+ | :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:`assertLesser ` | Checks that ``x <= y``. | +----------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------+ | :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.html`. | +----------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------+ | :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:`capture ` | Runs a function and capture standard otuput and error. | +----------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------+ | :meth:`fLOG ` | Prints out some information. :func:`fLOG`. | +----------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------+ | :meth:`profile ` | Profiles the execution of a function. | +----------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------+ | :meth:`read_file ` | Returns the content of a file. | +----------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------+ | :meth:`setUp ` | Filters out *FutureWarning*, *PendingDeprecationWarning*. | +----------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------+ | :meth:`tearDown ` | Stops filtering out *FutureWarning*, *PendingDeprecationWarning*. | +----------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------+ | :meth:`write_file ` | Writes the content of a file. | +----------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------+ Documentation +++++++++++++ .. automodule:: pyquickhelper.pycode.unittestclass :members: :special-members: __init__ :show-inheritance: