Skip to content

Commit

Permalink
Merge pull request #62 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 8db2a6b + 20694de commit bfed388
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tests/test_recall.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,30 @@ def test_RecallClass_init(self):
with self.assertRaises(Exception):
obj = TimeSeriesRecall(**test_case_3)

def test_RecallClass_score(self):
"""Test of score function.
"""

# test normal case
real = np.array([1, 1, 0, 0, 0])
pred = np.array([0, 1, 0, 0, 0])

obj = TimeSeriesRecall()

score = obj.score(real, pred)
self.assertEqual(score, 0.5)

# test invalid inputs
real = None
pred = np.array([0, 1, 0, 0, 0])
with self.assertRaises(Exception):
score = obj.score(real, pred)

real = np.array([1, 1, 0, 0, 0])
pred = None
with self.assertRaises(Exception):
score = obj.score(real, pred)

def test_recall_function(self):
"""Teest of ts_recall function.
"""
Expand Down

0 comments on commit bfed388

Please sign in to comment.