feat: 实现 Skills 跨榜去重与首日 baseline 模式判定
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -59,3 +59,44 @@ class NewsPushedLinksTests(unittest.TestCase):
|
||||
out = filter_unpushed_items(items, date_str="2026-07-09")
|
||||
self.assertEqual(len(out), 1)
|
||||
self.assertEqual(out[0]["link"], "https://example.com/b")
|
||||
|
||||
|
||||
class SkillMovePartitionTests(unittest.TestCase):
|
||||
def test_partition_dedupes_across_boards(self):
|
||||
trending = [
|
||||
{
|
||||
"id": "a/b/foo",
|
||||
"rank": 4,
|
||||
"title": "foo",
|
||||
"source": "a/b",
|
||||
"installs": 1,
|
||||
"link": "",
|
||||
"description": "",
|
||||
}
|
||||
]
|
||||
hot = [
|
||||
{
|
||||
"id": "a/b/foo",
|
||||
"rank": 2,
|
||||
"title": "foo",
|
||||
"source": "a/b",
|
||||
"installs": 1,
|
||||
"link": "",
|
||||
"description": "",
|
||||
}
|
||||
]
|
||||
from daily.delta import partition_skill_moves_for_wecom
|
||||
|
||||
t_out, h_out = partition_skill_moves_for_wecom(trending, hot)
|
||||
self.assertEqual(len(t_out), 1)
|
||||
self.assertEqual(len(h_out), 0)
|
||||
self.assertIn("Trending #4", t_out[0]["badge"])
|
||||
self.assertIn("Hot #2", t_out[0]["badge"])
|
||||
|
||||
def test_effective_mode_fallback_full_without_baseline(self):
|
||||
from daily.delta import effective_wecom_mode
|
||||
|
||||
with patch("daily.delta.find_previous_data", return_value=None):
|
||||
with patch("daily.delta.wecom_mode", return_value="delta"):
|
||||
with patch("daily.delta.delta_baseline_fallback", return_value="full"):
|
||||
self.assertEqual(effective_wecom_mode(date_str="2026-07-10"), "full")
|
||||
|
||||
Reference in New Issue
Block a user