Files
qwenpaw/tests/unit/plugins/test_download_catalog.py
agent-radar 1a3a4ccde1
Creator App Tests / PR Spam Gate (push) Skipped
Frontend Tests / PR Spam Gate (push) Skipped
NPM Format (website & console) / PR Spam Gate (push) Skipped
Pre-commit Checks / PR Spam Gate (push) Skipped
QwenPaw Creator Plugin Release / check-version (push) Canceled after 0s
QwenPaw Creator Plugin Release / upload-oss (push) Canceled after 0s
Tests / PR Spam Gate (push) Skipped
CodeQL / CodeQL (python) (push) Canceled after 0s
CodeQL / CodeQL (typescript) (push) Canceled after 0s
Creator App Tests / Creator Backend Tests (push) Canceled after 0s
Creator App Tests / Creator UI Build & Tests (push) Canceled after 0s
E2E Smoke Tests / Playwright UI Smoke (push) Canceled after 0s
Frontend Tests / Detect console changes (push) Canceled after 0s
NPM Format (website & console) / website format check (push) Canceled after 0s
NPM Format (website & console) / console format check (push) Canceled after 0s
Pre-commit Checks / Pre-commit (push) Canceled after 0s
QwenPaw Data Plugin Release / check-version (push) Canceled after 0s
Tests / Detect code changes (push) Canceled after 0s
Frontend Tests / Vitest Unit Tests (push) Canceled after 0s
Frontend Tests / Frontend Summary (push) Canceled after 0s
QwenPaw Data Plugin Release / upload-oss (push) Canceled after 0s
Tests / Maintainer Approval (push) Canceled after 0s
Tests / Unit Tests - py3.11 - macos-latest (push) Canceled after 0s
Tests / Unit Tests - py3.11 - ubuntu-latest (push) Canceled after 0s
Tests / Unit Tests - py3.13 - ubuntu-latest (push) Canceled after 0s
Tests / Unit Tests - py3.11 - windows-latest (push) Canceled after 0s
Tests / Contract Tests - py3.11 - macos-latest (push) Canceled after 0s
Tests / Contract Tests - py3.11 - ubuntu-latest (push) Canceled after 0s
Tests / Contract Tests - py3.13 - ubuntu-latest (push) Canceled after 0s
Tests / Contract Tests - py3.11 - windows-latest (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - macos-latest - p0 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - macos-latest - p1 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - macos-latest - p2 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - ubuntu-latest - fallback (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - ubuntu-latest - p0 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - ubuntu-latest - p1 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - ubuntu-latest - p2 (push) Canceled after 0s
Tests / Integrated Tests - py3.13 - ubuntu-latest - p0 (push) Canceled after 0s
Tests / Integrated Tests - py3.13 - ubuntu-latest - p1 (push) Canceled after 0s
Tests / Integrated Tests - py3.13 - ubuntu-latest - p2 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - windows-latest - p0 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - windows-latest - p1 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - windows-latest - p2 (push) Canceled after 0s
Tests / Coverage Report (push) Canceled after 0s
Tests / Test Summary (push) Canceled after 0s
源码快照 @ 2026-09-01 (source-only, 剔除非源码素材)
2026-09-01 20:01:50 +08:00

131 lines
3.7 KiB
Python

# -*- coding: utf-8 -*-
"""Unit tests for src/qwenpaw/plugins/download_catalog.py."""
from __future__ import annotations
from qwenpaw.plugins.download_catalog import _is_entry_compatible
def test_entry_with_qwenpaw_version_compatible() -> None:
entry = {
"id": "demo",
"version": "1.0.0",
# Exclusive upper bound: current 2.1.0b1 is treated as 2.1.0.
"qwenpaw_version": {"min": "1.1.6", "max": "2.2.0"},
}
assert _is_entry_compatible(entry) is True
def test_entry_with_qwenpaw_version_max_ignored() -> None:
"""Declared max must not exclude a newer running QwenPaw."""
entry = {
"id": "demo",
"version": "1.0.0",
"qwenpaw_version": {"min": "0.1.0", "max": "1.1.0"},
}
assert _is_entry_compatible(entry) is True
def test_entry_with_only_min_compatible() -> None:
entry = {
"id": "demo",
"version": "1.0.0",
# Derived exclusive max is 2.2.0 for min 2.1.0.
"qwenpaw_version": {"min": "2.1.0"},
}
assert _is_entry_compatible(entry) is True
def test_entry_with_only_min_incompatible() -> None:
entry = {
"id": "demo",
"version": "1.0.0",
"qwenpaw_version": {"min": "3.0.0"},
}
assert _is_entry_compatible(entry) is False
def test_entry_without_version_constraints_is_compatible() -> None:
entry = {
"id": "demo",
"version": "1.0.0",
}
assert _is_entry_compatible(entry) is True
def test_entry_with_malformed_qwenpaw_version_falls_to_legacy() -> None:
"""Non-dict qwenpaw_version falls back to min_version/max_version."""
entry = {
"id": "demo",
"version": "1.0.0",
"qwenpaw_version": "not-a-dict",
"min_version": "1.0.0",
"max_version": "2.2.0",
}
assert _is_entry_compatible(entry) is True
def test_entry_with_malformed_qwenpaw_version_no_legacy() -> None:
"""Non-dict qwenpaw_version with no legacy fields is compatible."""
entry = {
"id": "demo",
"version": "1.0.0",
"qwenpaw_version": "not-a-dict",
}
assert _is_entry_compatible(entry) is True
def test_legacy_min_version_compatible() -> None:
"""Legacy min_version within range is compatible."""
entry = {
"id": "demo",
"version": "1.0.0",
"min_version": "2.1.0",
}
assert _is_entry_compatible(entry) is True
def test_legacy_min_version_incompatible() -> None:
"""Legacy min_version above current QwenPaw is incompatible."""
entry = {
"id": "demo",
"version": "1.0.0",
"min_version": "3.0.0",
}
assert _is_entry_compatible(entry) is False
def test_legacy_min_max_version_compatible() -> None:
"""Legacy min+max still loads when min is satisfied (max ignored)."""
entry = {
"id": "demo",
"version": "1.0.0",
"min_version": "1.0.0",
"max_version": "2.2.0",
}
assert _is_entry_compatible(entry) is True
def test_legacy_max_version_ignored() -> None:
"""Legacy max_version alone must not make an entry incompatible."""
entry = {
"id": "demo",
"version": "1.0.0",
"min_version": "0.1.0",
"max_version": "1.0.0",
}
assert _is_entry_compatible(entry) is True
def test_entry_with_empty_dict_qwenpaw_version() -> None:
"""Empty dict qwenpaw_version triggers compat check with defaults."""
entry = {
"id": "demo",
"version": "1.0.0",
"qwenpaw_version": {},
}
# Empty dict is isinstance(dict) but has no min/max, should
# still pass through PluginManifest validation or fallback gracefully
result = _is_entry_compatible(entry)
assert isinstance(result, bool)