diff --git a/tests/test_recall.py b/tests/test_recall.py index 31b2514..8a0c4db 100644 --- a/tests/test_recall.py +++ b/tests/test_recall.py @@ -15,6 +15,28 @@ def test_recall_inherited_BaseTimeSeriesMetrics(self): isinstance(recall, BaseTimeSeriesMetrics) ) + def test_RecallClass_init(self): + """ Test of init function. + """ + + test_case_1 = {'alpha': 0.0, 'cardinality': 'one', 'bias': 'flat'} + test_case_2 = {'alpha': 0.0, 'cardinality': 'one', 'bias': None} + test_case_3 = {'alpha': 10.0, 'cardinality': 'one', 'bias': 'flat'} + + # test of the normal call + obj = TimeSeriesRecall(**test_case_1) + self.assertEqual(obj.alpha, test_case_1['alpha']) + self.assertEqual(obj.cardinality, test_case_1['cardinality']) + self.assertEqual(obj.bias, test_case_1['bias']) + + # test of the invalid bias + with self.assertRaises(Exception): + obj = TimeSeriesRecall(**test_case_2) + + # test of the invalid alpha + with self.assertRaises(Exception): + obj = TimeSeriesRecall(**test_case_3) + def test_recall_function(self): """Teest of ts_recall function. """