cgnal.core.tests package
Submodules
cgnal.core.tests.core module
Basic testing functionalities to be used in unittests.
- class cgnal.core.tests.core.TestCase(methodName='runTest')
Bases:
unittest.case.TestCase
,cgnal.core.logging.defaults.WithLogging
Tests class with basis functionalities.
Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.
- compareArrays(first: numpy.ndarray, second: numpy.ndarray, msg: str) None
Compare arrays.
- Parameters
first – first array
second – second array
msg – message
- Raises
failureException – if the dataframe are different
- compareDataFrames(first: pandas.core.frame.DataFrame, second: pandas.core.frame.DataFrame, msg: str) None
Compare dataframes.
- Parameters
first – first dataframe
second – second dataframe
msg – message
- Raises
failureException – if the dataframe are different
- compareDicts(first: dict, second: dict, strict: bool = False) None
Compare dictionaries.
- Parameters
first – first dictionary
second – second dictionary
strict – whether to check element by element (strict) or only dimensions (non-strict)
- compareDictsAlmostEqual(first: Dict[str, float], second: Dict[str, float], delta: float = 1e-12)
Compare dictionaries and check if they are almost equal.
- Parameters
first – first dictionary
second – second dictionary
delta – difference allowed between dictionaries’ elements
- compareLists(first: list, second: list, strict: bool = False) None
Compare lists.
- Parameters
first – first list
second – second list
strict – whether to check element by element (strict) or only dimensions (non-strict)
- compareSeries(first: pandas.core.series.Series, second: pandas.core.series.Series, msg: str) None
Compare series.
- Parameters
first – first series
second – second series
msg – message
- Raises
failureException – if the dataframe are different
- setUp() None
Set up the class to add custom comparing/assertion functionalities.
- cgnal.core.tests.core.logTest(test: Callable[[cgnal.core.tests.core.T], None]) Callable[[cgnal.core.tests.core.T], None]
Return a function to be used to decorate every test for adding logs on name of the tests and timings.
- Parameters
test – test method to wrap
- Returns
wrapped test method
Module contents
Test utils module.