Files
WoW-Hybrid-gateway/tests/item_misc_held_identity_family_test.py
praxisandClaude Fable 5.2 7f2139d8d0 Offline test fixtures
883 files, from working commit b1a079a.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-19 01:32:48 +02:00

46 lines
3.2 KiB
Python

#!/usr/bin/env python3
"""Exact misc held-offhand identity admission and iconless accessory holds."""
import argparse,copy,json,pathlib,sys
sys.path.insert(0,str(pathlib.Path(__file__).resolve().parents[1]/'ops'))
from item_basic_compat import catalog_record,encode as encode_basic
from item_sparse_compat import encode,package_pages
def refuses(fn):
try:fn()
except (ValueError,OverflowError):return
raise AssertionError('Unreviewed Basic identity or icon fallback admitted')
def main():
p=argparse.ArgumentParser();p.add_argument('--stage',type=pathlib.Path,required=True);a=p.parse_args();load=lambda x:json.loads(pathlib.Path(x).read_text())
ctx=load(a.stage/'context.json');pkg=load(a.stage/'package-compact.json');base=load(ctx['base'])
assert len(base['rows'])==83623 and len(pkg['rows'])==83625
assert pkg['rows'][:83623]==base['rows'] and pkg['pushes']==package_pages(pkg['rows'])
added=pkg['rows'][83623:];assert {(r['table_name'],r['id']) for r in added}=={('Item',42338),('ItemSparse',42338)}
original=ctx['native_controls'];assert original['count']==len(original['records'])==35
for r in original['records']:
assert (r['ClassID'],r['SubclassID'],r['InventoryType'])==(15,0,23)
assert encode_basic(r)
components={r['table_name']:r for r in added};r=components['Item']['record'];src=ctx['source']
assert (r['ClassID'],r['SubclassID'],r['InventoryType'])==(15,0,23)
assert r['IconFileDataID']==134200 and src['display_id']==31779
assert encode_basic(r).hex()==components['Item']['wire_hex']
assert components['ItemSparse']['wire_hex']==ctx['prior_sparse']['wire_hex']
assert encode(components['ItemSparse']['record'],ctx['schema']).hex()==ctx['prior_sparse']['wire_hex']
assert not components['Item']['dependency_complete'] and not components['Item']['gameplay_verified']
evidence=ctx['item']['icon']['target_reference']
assert catalog_record(src,None,icon_evidence=evidence)['record']==r
for field,value in [('subclass',1),('inventory_type',14),('class',12)]:
bad=copy.deepcopy(src);bad[field]=value
refuses(lambda:catalog_record(bad,None,icon_evidence=evidence))
holds=ctx['accessory_holds'];assert set(holds)=={'55208','55236'}
for item in holds.values():
source=item['source'];assert source['display_id']==0
assert source['inventory_type'] in(2,11) and item['errors']=={'Item':'source-display-missing'}
assert item['icon']=={'error':'source-display-missing'}
refuses(lambda:catalog_record(source,None,icon_evidence=None))
refuses(lambda:catalog_record(source,None,icon_evidence=evidence))
receipt={'status':'PASS','base_rows':83623,'new_rows':2,'rows':83625,'source_family_ids':[42338],'native_exact_category_controls':35,'source_icon_relation_retained':{'source_display_id':31779,'native_icon_id':134200},'sparse_component_bytes_preserved':True,'earlier_prefix_and_pages_exact':True,'other_classes_slots_subclasses_refused':True,'accessory_display0_holds_preserved':[55208,55236],'runtime_acceptance':False}
(a.stage/'validation.json').write_text(json.dumps(receipt,indent=2)+'\n')
print('PASS:shared misc-held identity/35native controls;2rows; prefix/Sparse bytes and accessory icon holds preserved')
if __name__=='__main__':main()