Files
douyi_guaji_main/tests/integration/test_fudai_analyse_init.py
T
Your Name 539e580147 feat: Add coverage report generation and enhance testing framework
- Introduced a new `.coverage` file for tracking test coverage metrics.
- Added `pytest.ini` configuration for streamlined testing setup, including coverage reporting and logging options.
- Created `requirements-test.txt` to manage testing dependencies, ensuring a consistent testing environment.
- Implemented a `run_tests.py` script to facilitate running tests with various options, including unit and integration tests.
- Established a structured testing directory with unit and integration tests, enhancing code reliability and maintainability.
- Updated documentation to reflect new testing procedures and configurations.
2025-12-22 13:26:26 +08:00

46 lines
1.5 KiB
Python

"""
fudai_analyse初始化集成测试
"""
import pytest
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