Initial commit: LastRecc discovery feed and weekly engine
This commit is contained in:
40 files changed
+6972
No files matched your search
@@ -0,0 +1,22 @@
|
||||
import time
|
||||
import unittest
|
||||
|
||||
from lastrecc.recommend import _duration_seconds, _recency_weight
|
||||
|
||||
|
||||
class ScoringTests(unittest.TestCase):
|
||||
def test_recent_play_outweighs_old_play(self):
|
||||
now = int(time.time())
|
||||
recent = _recency_weight(now - 86400, now)
|
||||
old = _recency_weight(now - 60 * 86400, now)
|
||||
self.assertGreater(recent, old)
|
||||
self.assertAlmostEqual(_recency_weight(now, now), 1.0)
|
||||
|
||||
def test_track_info_milliseconds(self):
|
||||
self.assertEqual(_duration_seconds("197000"), 197)
|
||||
self.assertEqual(_duration_seconds(203), 203)
|
||||
self.assertEqual(_duration_seconds(None), 0)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in new issue
Block a user