nnfwtbn.tests package¶
Submodules¶
nnfwtbn.tests.test_cut module¶
-
class
nnfwtbn.tests.test_cut.
CutTestCase
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
Test the implementation of the cut class.
-
__module__
= 'nnfwtbn.tests.test_cut'¶
-
test_call
()[source]¶ Check that calling the cut returns a dataframe containing the events rather than returning an index array.
-
test_call_empty_input
()[source]¶ Check that calling the object returns an empty dataframe if the input dataframe is empty.
-
test_call_no_match
()[source]¶ Check that calling the object returns an empty dataframe when no event matches the selection.
-
test_init_cut_name_inherit
()[source]¶ Check that the name of a cut passed to the constructor is inherited.
-
test_init_cut_name_inherit_precedence
()[source]¶ Check that the name argument has precedence over the given cut.
-
test_init_with_lambda
()[source]¶ Check that creating a cut with a lambda expression applies the uses the lambda to filter the dataframe.
-
nnfwtbn.tests.test_hist module¶
nnfwtbn.tests.test_model module¶
-
class
nnfwtbn.tests.test_model.
BinaryCVTestCase
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
Test the implementation of binary cross validation.
-
__module__
= 'nnfwtbn.tests.test_model'¶
-
test_saving_and_loading
()[source]¶ Test that saving and loading a cross validator doesn’t change its configuration.
-
test_select_cv_set_training
()[source]¶ Check that only the training events of each slice are returned.
-
-
class
nnfwtbn.tests.test_model.
CategoricalWeightNormalizerTestCase
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
Test the implementation of normalize_category_weights.
-
__module__
= 'nnfwtbn.tests.test_model'¶
-
-
class
nnfwtbn.tests.test_model.
ClassicalCVTestCase
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
Test the implementation of classical cross validation with k=4.
-
__module__
= 'nnfwtbn.tests.test_model'¶
-
-
class
nnfwtbn.tests.test_model.
CrossValidatorTestCase
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
Test the non-abstract parts of CrossValidator class.
-
__module__
= 'nnfwtbn.tests.test_model'¶
-
test_equal_different_class
()[source]¶ Check the equal operator for cross validators with different types.
-
test_equal_different_k
()[source]¶ Check the equal operator for cross validators with different values for k.
-
test_equal_different_variables
()[source]¶ Check the equal operator for cross validators with different variable names.
-
test_equal_same_values
()[source]¶ Check the equal operator for cross validators which are created with the same values.
-
test_init_both_methods
()[source]¶ Check that an error is raised if both selection methods are used constructor.
-
-
class
nnfwtbn.tests.test_model.
EstimatorNormalizerTestCase
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
Test the implementation of EstimatorNormalizer.
-
__module__
= 'nnfwtbn.tests.test_model'¶
-
test_call_other_vars
()[source]¶ Check that columns in the dataframe are left untouched if moments are missing.
-
test_init
()[source]¶ Check that the constructor computes the normalization moments of all columns in the given dataframe if no input_list is given.
-
-
class
nnfwtbn.tests.test_model.
HepNetTestCase
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
-
__module__
= 'nnfwtbn.tests.test_model'¶
-
-
class
nnfwtbn.tests.test_model.
MixedCVTestCase
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
Test the implementation of mixed cross validation with k=8.
-
__module__
= 'nnfwtbn.tests.test_model'¶
-
-
class
nnfwtbn.tests.test_model.
NoTestCVTestCase
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
Test the implementation of no-test cross validation.
-
__module__
= 'nnfwtbn.tests.test_model'¶
-
-
class
nnfwtbn.tests.test_model.
StubCrossValidator
(k, mod_var=None, frac_var=None)[source]¶ Bases:
nnfwtbn.model.CrossValidator
-
__abstractmethods__
= frozenset({})¶
-
__module__
= 'nnfwtbn.tests.test_model'¶
-
select_slice
(df, slice_i)[source]¶ Returns the index array to select all events from the dataset of a given slice.
NB: This method is for internal usage only. There might be more than k slices.
-
select_test
(df, fold_i)[source]¶ Returns the index array to select all test events from the dataset for the given fold.
-
nnfwtbn.tests.test_plot module¶
-
class
nnfwtbn.tests.test_plot.
DaskComputeTestCase
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
Test the implementation of _dask_compute()
-
__module__
= 'nnfwtbn.tests.test_plot'¶
-
-
class
nnfwtbn.tests.test_plot.
HelperMethodsTestCase
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
Check that helper methods are implemented correctly
-
__module__
= 'nnfwtbn.tests.test_plot'¶
-
-
class
nnfwtbn.tests.test_plot.
PlotTestCases
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
Test the implementation of the functions in the plot module. These are actual tests, not only survival tests.
-
__module__
= 'nnfwtbn.tests.test_plot'¶
-
-
class
nnfwtbn.tests.test_plot.
SurvivalTestCase
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
Test that calling the plotting methods does not cause a crash.
(Testing plotting methods is notoriously difficult.)
-
__module__
= 'nnfwtbn.tests.test_plot'¶
-
test_confusion_matrix_argument_reverse
()[source]¶ Check that confusion_matrix does not change the arguments.
-
test_hist_return_wo_ratio
()[source]¶ Check that the return value is not None if there is no ratio plot.
-
nnfwtbn.tests.test_process module¶
-
class
nnfwtbn.tests.test_process.
ProcessTestCase
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
Test the implementation of the Process class.
-
__module__
= 'nnfwtbn.tests.test_process'¶
-
test_default_range_var
()[source]¶ Check that the default range_var value is taken from the class property.
-
test_idx_array
()[source]¶ Check that calling idx_array() returns an index array with selected events.
-
test_init_selection_and_range
()[source]¶ Check that an error is raised if both selection and range is passed to the constructor.
-
test_range_type
()[source]¶ Check that an exception is raised if the range argument is not a tuple of two numbers.
-
test_range_var_store
()[source]¶ Check that the range_var argument takes precedence over the class constant.
-
nnfwtbn.tests.test_stack module¶
-
class
nnfwtbn.tests.test_stack.
TestStack
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
Test the implementation of the Stack class.
-
__module__
= 'nnfwtbn.tests.test_stack'¶
-
test_add_process_append_kwds
()[source]¶ Check that adding a process appends the custom kwds to the internal lists.
-
test_add_process_append_process
()[source]¶ Check that adding a process appends the new process to the internal lists.
-
test_add_process_store_kwds
()[source]¶ Check that add_process() stores the custom kwds of the process.
-
test_data_stack_raises
()[source]¶ Check that data_stack raises an exception if the data_uncertainty argument is used.
-
test_get_aux_custom
()[source]¶ Check that get_aux() returns the default aux values when the process was added with custom aux values.
-
test_get_aux_default
()[source]¶ Check that get_aux() returns the default aux values when the process was added without a custom aux value.
-
test_get_aux_init_process
()[source]¶ Check that get_aux() returns the default aux values when the process was passed to the constructor.
-
test_get_aux_none_overwrite
()[source]¶ Check that passing None as an aux keyword overwrites the default.
-
test_get_aux_not_modify_outer
()[source]¶ Check that calling get_aux() does not modify dicts from the constructor, add_process() or the internal one.
-
test_get_histtype_custom
()[source]¶ Check that get_histtype() returns the default histtype when the process was added with a custom histtype.
-
test_get_histtype_default
()[source]¶ Check that get_histtype() returns the default histtype when the process was added without a custom histtype.
-
test_get_histtype_init_process
()[source]¶ Check that get_histtype() returns the default histtype when the process was passed to the constructor.
-
test_hist
()[source]¶ Check that get_hist() returns the histogram for a single progress when the i argument is used.
-
test_init_defaults
()[source]¶ Check that the default values fr histtype and data_uncertainty are not None.
-
test_init_store_kwds
()[source]¶ Check that the keyword arguments passed to the constructor are stored.
-
test_init_store_processes_empty
()[source]¶ Check that passing no processes to the constructor works.
-
test_is_data_uncertainty_custom
()[source]¶ Check that is_data_uncertainty() returns the default uncertainty value when the process was added with a custom data_uncertainty value.
-
test_is_data_uncertainty_default
()[source]¶ Check that is_data_uncertainty() returns the default uncertainty value when the process was added without a custom data_uncertainty value.
-
test_is_data_uncertainty_init_process
()[source]¶ Check that is_data_uncertainty() returns the default uncertainty vlaue when the process was passed to the constructor.
-
test_len_add
()[source]¶ Check that len() returns the number of processes passed to the constructor when add_process() is not called.
-
test_len_init
()[source]¶ Check that len() returns the number of processes passed to the constructor when add_process() is not called.
-
test_mc_stack_raises
()[source]¶ Check that mc_stack raises an exception if the data_uncertainty argument is used.
-
test_not_none_or_default_False
()[source]¶ Check that not_none_or_default() returns the value if the value is False.
-
test_not_none_or_default_None
()[source]¶ Check that not_none_or_default() returns the default if the value is None.
-
test_not_none_or_default_NoneDefault
()[source]¶ Check that not_none_or_default() returns the value if the value is a non-empty string.
-
test_not_none_or_default_NotNone
()[source]¶ Check that not_none_or_default() returns the value if the value is a non-empty string.
-
nnfwtbn.tests.test_toydata module¶
nnfwtbn.tests.test_variable module¶
-
class
nnfwtbn.tests.test_variable.
RangeBlindingTestCase
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
Test the implementation of the RangeBlinding class.
-
__module__
= 'nnfwtbn.tests.test_variable'¶
-
test_bin_border_left
()[source]¶ Check that the blinding does not break if the blinding is left of the first bin.
-
-
class
nnfwtbn.tests.test_variable.
VariableTestCase
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
Test the implementation of the variable class.
-
__module__
= 'nnfwtbn.tests.test_variable'¶
-
test_equal_different_definition
()[source]¶ Check that variables with a different definition are not equal.
-
test_equal_same_values
()[source]¶ Check the equal operator for variables which are created with the same values.
-
test_init_blinding_type
()[source]¶ Check that an error is thrown if the blinding object is not an instance of the abstract blinding class.
-