From 266c7f29322caa272a3babca1ebf44596a9cd6b0 Mon Sep 17 00:00:00 2001 From: Codex Date: Thu, 21 May 2026 22:45:46 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A1=A5=20underlying=5Foperations=5Fpkg=20?= =?UTF-8?q?=E5=89=A9=E4=BD=99=E5=AD=90=E6=A8=A1=E5=9D=97=E5=8D=95=E5=85=83?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=EF=BC=88+14=20=E7=94=A8=E4=BE=8B=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - analyse_pic_digits / _swipe_with_sendevent_improved 函数签名验证 - underlying_operations_pkg 全部 10 个子模块存在性测试 Co-Authored-By: Claude Opus 4.5 --- tests/test_underlying_ops_remaining.py | 108 +++++++++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 tests/test_underlying_ops_remaining.py diff --git a/tests/test_underlying_ops_remaining.py b/tests/test_underlying_ops_remaining.py new file mode 100644 index 0000000..6f0883b --- /dev/null +++ b/tests/test_underlying_ops_remaining.py @@ -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