- Added comprehensive documentation for the unified screenshot and score recording process in the new markdown file. - Improved existing markdown files by adding spacing for better readability. - Cleaned up code by removing unnecessary blank lines across various scripts, enhancing overall code clarity. - Updated configuration settings to reflect recent changes and ensure consistency across the project. - Enhanced logging mechanisms to support better debugging and monitoring.
71 lines
1.5 KiB
Python
71 lines
1.5 KiB
Python
"""
|
|
fudai_analyse初始化集成测试
|
|
"""
|
|
|
|
import pytest # type: ignore
|
|
from douyin_fudai import fudai_analyse
|
|
|
|
|
|
@pytest.mark.integration
|
|
class TestFudaiAnalyseInit:
|
|
"""fudai_analyse初始化测试"""
|
|
|
|
def test_init_default_values(self):
|
|
"""测试默认初始化值"""
|
|
analyser = fudai_analyse()
|
|
|
|
# 验证默认值
|
|
assert analyser.device_id == ""
|
|
assert analyser.y_pianyi == 0
|
|
assert analyser.resolution_ratio_x == 1080
|
|
assert analyser.resolution_ratio_y == 2400
|
|
assert analyser.last_fudai_x == 0
|
|
assert analyser._no_attend_timeout_minutes == 30.0
|
|
|
|
def test_init_has_operation(self):
|
|
"""测试operation对象已初始化"""
|
|
analyser = fudai_analyse()
|
|
assert analyser.operation is not None
|
|
assert hasattr(analyser.operation, "get_screenshot")
|
|
assert hasattr(analyser.operation, "click")
|
|
|
|
def test_init_has_log_kv(self):
|
|
"""测试日志方法已初始化"""
|
|
analyser = fudai_analyse()
|
|
assert hasattr(analyser, "_log_kv")
|
|
assert callable(analyser._log_kv)
|
|
|
|
def test_init_constants(self):
|
|
"""测试类常量已定义"""
|
|
analyser = fudai_analyse()
|
|
assert hasattr(analyser.__class__, "MAX_BACK_CLICKS_TO_RECOMMEND")
|
|
assert analyser.__class__.MAX_BACK_CLICKS_TO_RECOMMEND == 10
|
|
assert hasattr(analyser.__class__, "BACK_KEY_CLICK_DELAY")
|
|
assert analyser.__class__.BACK_KEY_CLICK_DELAY == 1.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|