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

32 lines
1.7 KiB
Python

import struct,sys,unittest,copy,json
from pathlib import Path
sys.path.insert(0,str(Path(__file__).resolve().parents[1]/'ops'))
from profession_profile import primary_ids,profession_ids,child_pairs
def dbc(entries):
rows=[]
for ident,category in entries:rows.append(struct.pack('<22I',ident,category,*([0]*20)))
return struct.pack('<4s4I',b'WDBC',len(rows),22,88,1)+b''.join(rows)+b'\0'
class ProfessionProfileTest(unittest.TestCase):
def test_native_children_preserve_parent_identity_and_bound_slots(self):
p=json.loads((Path(__file__).resolve().parents[1]/'docs/evidence/gameplay/profession-skill-children-70334.json').read_text())
parents=[r['ParentSkillLineID']for r in p['rows']]
self.assertEqual(len(child_pairs(p,parents)),12)
for mutate in ('layout','duplicate','tier','parent','id'):
q=copy.deepcopy(p)
if mutate=='layout':q['layout_hash']='0x0'
elif mutate=='duplicate':q['rows'].append(q['rows'][0])
elif mutate=='tier':q['rows'][0]['ParentTierIndex']=5
elif mutate=='parent':q['rows'][0]['ParentSkillLineID']=65534
else:q['rows'][0]['ID']=65536
with self.assertRaises(ValueError):child_pairs(q,parents)
def test_categories_not_specific_character_skills(self):
self.assertEqual(primary_ids(dbc([(755,11),(185,9),(43,6),(164,11)])),[164,755])
self.assertEqual(profession_ids(dbc([(755,11),(185,9),(43,6),(164,11)])),([164,755],[164,185,755]))
def test_schema_identity_and_bounds(self):
for raw in (dbc([(164,11),(164,11)]),dbc([(0,11)]),dbc([(65536,11)]),dbc([(164,11)])[:-1],dbc([(185,9)])):
with self.assertRaises(ValueError):primary_ids(raw)
if __name__=='__main__':unittest.main()