diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index 91defae7..921f8da0 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -9,7 +9,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, macos-latest, windows-latest] - python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] + python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] exclude: # Python < v3.8 does not support Apple Silicon ARM64. - python-version: "3.7" os: macos-latest diff --git a/test/test_engine.py b/test/test_engine.py index 579c7411..5dca14a9 100644 --- a/test/test_engine.py +++ b/test/test_engine.py @@ -55,3 +55,16 @@ class TestEngine(unittest.TestCase): # importlib.reload(collections.abc) # 重新加载模块以应用补丁 assert collections.abc.Iterable.__module__ == "collections.abc" + + def test_iterable_import(self): + # 尝试从 collections.abc 导入 Iterable + try: + from collections.abc import Iterable + self.assertTrue(True) # 如果成功导入,测试通过 + except ImportError: + # 如果从 collections.abc 导入失败,则尝试从 collections 导入 + try: + from collections import Iterable + self.assertTrue(True) # 如果这里成功导入,测试通过 + except ImportError: + self.fail("Failed to import Iterable from both collections.abc and collections") # 如果两者都失败,则测试不通过