Files
lc-mcp/tests/test_shop_lists.py
T
ywsandClaude Opus 5.5 72d2ca1a5b AALC 升级到 V1.6.1 并按零协汉化核对镜牢补丁
- vendor/aalc: e1d1749 -> 2fcb1b4(V1.6.1)。上游 8196e72 修好了商店三个清单的
  路径, 删掉本地 install_shop_lists, test_shop_lists 改成守着上游 5/19/31。
- 上游 18deb77 把事件里找 "???" 改成 find_element 后自己点, 原事件表补丁挂在
  click_element 上会悄悄失效。改挂 find_element, 上游拿返回位置再点的那下吞掉;
  小指良单通模式再找 "???" 时返回没有, 不会改点别的选项。
- 事件表改成按同一屏其它选项的原文认事件(零协汉化的事件数据没有标题), 选项原文
  照抄 LLC_zh-CN/ActionEvents_*.json 并带事件 id; 去掉 index 规则。核对后保留
  6 条, 删掉汉化里对不上或说法矛盾的 4 条(两个睡袋、浸染棉花、终末日历); 失明巨人
  是判定, 标 check。选项比较前去标点。
- 饰品关键词按零协汉化体系名核对, 删掉汉化里从未出现的 出血。
- 事件表、饰品排序安装时检查上游源码里还有被拦截的调用, 没有就记 [ERROR] 跳过;
  包装函数带 __wrapped__, 叠装时也能查到上游源码。
- BACKLOG 记录这次升级对各补丁的影响和核对结果。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 08:43:27 +00:00

63 lines
2.2 KiB
Python

# -*- coding: utf-8 -*-
"""镜牢商店"必买 / 必卖 / 公式合成"清单(BACKLOG P0-1)。
2026-11-14 实测: 上游 tasks/mirror/__init__.py 按旧路径 ./assets/images/share/... 列目录, 三个清单恒为空,
进店 51 秒一件没买。上游 8196e72(V1.6.1) 改成按 assets/images/default/share/... 列, 本地补丁随之删掉;
这里守着上游别再退回空清单。
"""
import os
import types
import unittest
from contextlib import contextmanager
from pathlib import Path
REPO = Path(__file__).resolve().parents[1]
AALC = REPO / 'vendor' / 'aalc'
INIT = AALC / 'tasks' / 'mirror' / '__init__.py'
SHOP_LISTS = ('must_purchase', 'must_be_abandoned', 'fusion_result')
IMAGE_ROOTS = ('dark/zh_cn', 'dark/en', 'dark/share', 'default/zh_cn', 'default/en', 'default/share')
@contextmanager
def chdir(path):
old = os.getcwd()
os.chdir(path)
try:
yield
finally:
os.chdir(old)
def upstream_mirror_package():
"""在 AALC 目录下执行上游 tasks/mirror/__init__.py(任务进程的工作目录也是这里)。"""
module = types.ModuleType('tasks.mirror')
with chdir(AALC):
exec(compile(INIT.read_text(encoding='utf-8'), str(INIT), 'exec'), module.__dict__)
return module
@unittest.skipUnless(INIT.is_file(), 'vendor/aalc 子模块未检出')
class UpstreamShopListTest(unittest.TestCase):
def test_upstream_lists_are_filled(self):
package = upstream_mirror_package()
self.assertEqual([len(getattr(package, k)) for k in SHOP_LISTS], [5, 19, 31])
self.assertIn('mirror/shop/must_purchase/carmilla.png', package.must_purchase)
def test_every_listed_name_resolves_under_some_image_root(self):
package = upstream_mirror_package()
images = AALC / 'assets' / 'images'
for kind in SHOP_LISTS:
for name in getattr(package, kind):
with self.subTest(name=name):
self.assertTrue(any((images / root / name).is_file() for root in IMAGE_ROOTS))
def test_roots_match_aalc_path_manager(self):
source = (AALC / 'utils' / 'path_manager.py').read_text(encoding='utf-8')
for root in IMAGE_ROOTS:
self.assertIn('"%s"' % root, source)
if __name__ == '__main__':
unittest.main()