Skip to content

Commit

Permalink
Merge pull request #61 from CompML/features/#41/unit_test_for_recall
Browse files Browse the repository at this point in the history
add test case
  • Loading branch information
nocotan authored Jan 2, 2021
2 parents 3b8f6eb + 995c562 commit 8db2a6b
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/test_recall.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
"""
Expand Down

0 comments on commit 8db2a6b

Please sign in to comment.