补 underlying_operations_pkg 剩余子模块单元测试(+14 用例)
- analyse_pic_digits / _swipe_with_sendevent_improved 函数签名验证 - underlying_operations_pkg 全部 10 个子模块存在性测试 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
59ac6a3abc
commit
266c7f2932
1 file changed
+108
@@ -0,0 +1,108 @@
|
||||
"""underlying_operations_pkg 剩余子模块单元测试。
|
||||
|
||||
覆盖:
|
||||
- ocr_digits: analyse_pic_digits 函数签名
|
||||
- swipe_sendevent: _swipe_with_sendevent_improved 函数签名
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import inspect
|
||||
import pytest
|
||||
|
||||
|
||||
class TestOcrDigits:
|
||||
"""ocr_digits 模块测试。"""
|
||||
|
||||
def test_function_exists(self):
|
||||
from douyin.core.underlying_operations_pkg.ocr_digits import analyse_pic_digits
|
||||
|
||||
assert callable(analyse_pic_digits)
|
||||
|
||||
def test_function_signature(self):
|
||||
from douyin.core.underlying_operations_pkg.ocr_digits import analyse_pic_digits
|
||||
|
||||
sig = inspect.signature(analyse_pic_digits)
|
||||
params = list(sig.parameters.keys())
|
||||
assert "analyser" in params
|
||||
assert "picname" in params
|
||||
assert "change_color" in params
|
||||
assert "pic_path" in params
|
||||
|
||||
|
||||
class TestSwipeSendevent:
|
||||
"""swipe_sendevent 模块测试。"""
|
||||
|
||||
def test_function_exists(self):
|
||||
from douyin.core.underlying_operations_pkg.swipe_sendevent import (
|
||||
_swipe_with_sendevent_improved,
|
||||
)
|
||||
|
||||
assert callable(_swipe_with_sendevent_improved)
|
||||
|
||||
def test_function_signature(self):
|
||||
from douyin.core.underlying_operations_pkg.swipe_sendevent import (
|
||||
_swipe_with_sendevent_improved,
|
||||
)
|
||||
|
||||
sig = inspect.signature(_swipe_with_sendevent_improved)
|
||||
params = list(sig.parameters.keys())
|
||||
assert "device_id" in params
|
||||
assert "x1" in params
|
||||
assert "y1" in params
|
||||
assert "x2" in params
|
||||
assert "y2" in params
|
||||
|
||||
|
||||
class TestUnderlyingOperationsPkgSubmodules:
|
||||
"""underlying_operations_pkg 子模块存在性测试。"""
|
||||
|
||||
def test_ocr_digits_importable(self):
|
||||
from douyin.core.underlying_operations_pkg import ocr_digits
|
||||
|
||||
assert ocr_digits is not None
|
||||
|
||||
def test_swipe_sendevent_importable(self):
|
||||
from douyin.core.underlying_operations_pkg import swipe_sendevent
|
||||
|
||||
assert swipe_sendevent is not None
|
||||
|
||||
def test_adb_helpers_importable(self):
|
||||
from douyin.core.underlying_operations_pkg import adb_helpers
|
||||
|
||||
assert adb_helpers is not None
|
||||
|
||||
def test_bounds_importable(self):
|
||||
from douyin.core.underlying_operations_pkg import bounds
|
||||
|
||||
assert bounds is not None
|
||||
|
||||
def test_clipboard_importable(self):
|
||||
from douyin.core.underlying_operations_pkg import clipboard
|
||||
|
||||
assert clipboard is not None
|
||||
|
||||
def test_countdown_importable(self):
|
||||
from douyin.core.underlying_operations_pkg import countdown
|
||||
|
||||
assert countdown is not None
|
||||
|
||||
def test_device_select_importable(self):
|
||||
from douyin.core.underlying_operations_pkg import device_select
|
||||
|
||||
assert device_select is not None
|
||||
|
||||
def test_ocr_content_importable(self):
|
||||
from douyin.core.underlying_operations_pkg import ocr_content
|
||||
|
||||
assert ocr_content is not None
|
||||
|
||||
def test_pic_path_importable(self):
|
||||
from douyin.core.underlying_operations_pkg import pic_path
|
||||
|
||||
assert pic_path is not None
|
||||
|
||||
def test_reward_pic_importable(self):
|
||||
from douyin.core.underlying_operations_pkg import reward_pic
|
||||
|
||||
assert reward_pic is not None
|
||||
Reference in new issue
Block a user