feat(utils): Refactor check_method to use ast

- 使用 AST 解析函数源码,相比基于字符串的方法更稳定,能够正确处理具有多行 def 语句的函数
- 为 check_method 添加了单元测试
This commit is contained in:
wumode
2025-11-05 13:45:31 +08:00
parent 8e7d040ac4
commit ff2826a448
3 changed files with 74 additions and 30 deletions

View File

@@ -1,6 +1,8 @@
import unittest
from tests.test_metainfo import MetaInfoTest
from tests.test_object import ObjectUtilsTest
if __name__ == '__main__':
suite = unittest.TestSuite()
@@ -8,6 +10,7 @@ if __name__ == '__main__':
# 测试名称识别
suite.addTest(MetaInfoTest('test_metainfo'))
suite.addTest(MetaInfoTest('test_emby_format_ids'))
suite.addTest(ObjectUtilsTest('test_check_method'))
# 运行测试
runner = unittest.TextTestRunner()