fix countdown frame fallback
This commit is contained in:
1 parent
3ace80dcca
commit
a2a899bb9f
5 files changed
+74
-25
No files matched your search
@@ -1,8 +1,10 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from types import SimpleNamespace
|
||||
from unittest.mock import MagicMock
|
||||
|
||||
from douyin.fudai.douyin_fudai_contain_impl import (
|
||||
_apply_countdown_text_fallback,
|
||||
_build_countdown_candidate_boxes,
|
||||
_parse_mmss_from_full_text,
|
||||
_select_countdown_from_candidates,
|
||||
@@ -194,3 +196,37 @@ def test_parse_mmss_from_full_text_ignores_non_countdown_text():
|
||||
mm, ss = _parse_mmss_from_full_text("直播间,否则会失去抽奖机会")
|
||||
assert mm == ""
|
||||
assert ss == ""
|
||||
|
||||
|
||||
def test_parse_mmss_from_full_text_ignores_product_model_digits_without_countdown_hint():
|
||||
mm, ss = _parse_mmss_from_full_text("G4939-敦煌飞天帝王黄茶叶罐")
|
||||
assert mm == ""
|
||||
assert ss == ""
|
||||
|
||||
|
||||
def test_countdown_text_fallback_ignores_content_product_digits_without_countdown_hint():
|
||||
analyser = SimpleNamespace(fudai_detail_verbose_logs=False)
|
||||
|
||||
mm, ss = _apply_countdown_text_fallback(
|
||||
analyser,
|
||||
"",
|
||||
"",
|
||||
(("content", "G4939-敦煌飞天帝王黄茶叶罐"),),
|
||||
)
|
||||
|
||||
assert mm == ""
|
||||
assert ss == ""
|
||||
|
||||
|
||||
def test_countdown_text_fallback_does_not_use_content_even_with_countdown_text():
|
||||
analyser = SimpleNamespace(fudai_detail_verbose_logs=False)
|
||||
|
||||
mm, ss = _apply_countdown_text_fallback(
|
||||
analyser,
|
||||
"",
|
||||
"",
|
||||
(("content", "免费购129人已参与00 : 00后开奖"),),
|
||||
)
|
||||
|
||||
assert mm == ""
|
||||
assert ss == ""
|
||||
Reference in new issue
Block a user