Files
WoW-Hybrid-gateway/tests/item_body_descriptor_compat_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

60 lines
4.2 KiB
Python

#!/usr/bin/env python3
"""Captured ordinary-body controls; slot routing and native witness boundaries."""
import json,sys,unittest
from copy import deepcopy
from pathlib import Path
sys.path.insert(0,str(Path(__file__).resolve().parents[1]/'ops'))
from item_body_descriptor_compat import review_binding,body_contract
F=json.loads((Path(__file__).parent/'fixtures/source-body-descriptor-witnesses.json').read_text())
class BodyDescriptorWitnessTest(unittest.TestCase):
def setUp(self):
self.f=deepcopy(F);self.case=self.f['cases'][0]
def review(self,c=None):
c=c or self.case
return review_binding(c['binding'],c['display'],self.f['native'],{r['ID']:r for r in self.f['basics']},{r['ID']:r for r in self.f['sparse']},c['item'],c['item_sparse'],c['binding']['item_id'])
def reject(self):
with self.assertRaises(ValueError):self.review()
def test_complete_ten_item_family(self):
self.assertEqual({c['binding']['item_id']for c in self.f['cases']},{33021,33029,33030,33033,33035,33037,33181,33239,42275,42276})
for c in self.f['cases']:
with self.subTest(item=c['binding']['item_id']):self.assertEqual(self.review(c)[1],1)
def test_model_descriptor_text_has_no_body_consumer_semantics(self):
s=self.case['binding']['native_body_witness']['source'];before=body_contract(s)
s['composition']['ModelName']=['different non-file descriptor',''];self.assertEqual(body_contract(s),before);self.review()
def test_rigid_attachment_slots_excluded(self):
for inv in (1,3,13,14,15,16,17,21,22,23,25,26,27):
with self.subTest(inventory=inv):
s=deepcopy(self.case['binding']['native_body_witness']['source']);s['inventory_type']=inv
with self.assertRaises(ValueError):body_contract(s)
def test_same_slot_cross_armor_subclass_native_witness_is_valid(self):
c=next(c for c in self.f['cases']if c['binding']['item_id']==33029)
self.assertNotEqual(c['binding']['native_body_witness']['source']['source_subclass'],c['binding']['native_body_witness']['witnesses'][0]['source']['source_subclass']);self.review(c)
def test_source_inventory_identity_mismatch(self):
self.case['item']['InventoryType']=1;self.reject()
def test_source_name_identity_mismatch(self):
self.case['item_sparse']['Display_lang']='Other item';self.reject()
def test_source_subclass_identity_mismatch(self):
self.case['item']['SubclassID']=4;self.reject()
def test_source_sections_must_match_witness(self):
self.case['binding']['native_body_witness']['source']['composition']['Texture'][0]='additional_section';self.reject()
def test_source_geosets_must_match_exact_native_control(self):
self.case['binding']['native_body_witness']['source']['composition']['GeosetGroup'][0]+=1;self.reject()
def test_unknown_source_flags_held(self):
self.case['binding']['native_body_witness']['source']['composition']['Flags']=[16];self.reject()
def test_native_model_type_must_match_exact_control(self):
self.case['display']['ModelType']=[-1,-1];self.reject()
def test_native_attached_model_cannot_be_ignored(self):
self.case['display']['ModelResourcesID']=[900,0];self.reject()
def test_native_identity_cannot_be_same_number_other_item(self):
w=self.case['binding']['native_body_witness']['witnesses'][0];next(r for r in self.f['sparse']if r['ID']==w['source']['item_id'])['Display_lang']='Different native item';self.reject()
def test_native_link_must_be_original_default(self):
w=self.case['binding']['native_body_witness']['witnesses'][0];next(r for r in self.f['native']['ItemModifiedAppearance']if r['ID']==w['native_link_id'])['ItemAppearanceModifierID']=1;self.reject()
def test_native_geometry_change_rejected(self):
w=self.case['binding']['native_body_witness']['witnesses'][0];next(r for r in self.f['native']['ItemDisplayInfo']if r['ID']==w['native_display_id'])['AttachmentGeosetGroup'][0]=99;self.reject()
def test_native_duplicate_witness_rejected(self):
p=self.case['binding']['native_body_witness'];p['witnesses']*=2;self.reject()
def test_sparse_namespace_identity_required(self):
c=self.case
with self.assertRaises(ValueError):review_binding(c['binding'],c['display'],self.f['native'],{r['ID']:r for r in self.f['basics']},{r['ID']:r for r in self.f['sparse']},c['item'],c['item_sparse'],999)
if __name__=='__main__':unittest.main()