Utility tools for writing unit tests for packages which rely on sentinelhub-py
Class implementing common functionalities of unit tests for working with sentinelhub-py package:
- reading configuration parameters from environmental variables and saving them to config.json,
- setting logger,
- handling input and output data folders,
- method for testing statistics of a numpy data array.
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.
A general set up class
super().setUpClass()in every class which inherits
Hook method for deconstructing the class fixture after running all tests in the class.
test_numpy_data(data=None, exp_shape=None, exp_dtype=None, exp_min=None, exp_max=None, exp_mean=None, exp_median=None, delta=None, test_name='')¶
Validates basic statistics of data array
- data (numpy.ndarray) – Data array
- exp_shape (tuple(int)) – Expected shape
- exp_dtype (numpy.dtype) – Expected dtype
- exp_min (float) – Expected minimal value
- exp_max (float) – Expected maximal value
- exp_mean (float) – Expected mean value
- exp_median (float) – Expected median value
- delta (float) – Precision of validation. If not set, it will be set automatically
- test_name (str) – Name of the test case