883 files, from working commit b1a079a. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
25 lines
1.6 KiB
Python
25 lines
1.6 KiB
Python
"""Package masks require exact wire/source effect agreement, never an ID allowlist."""
|
|
import copy,json,sys,unittest
|
|
from pathlib import Path
|
|
ROOT=Path(__file__).resolve().parents[1];sys.path.insert(0,str(ROOT/'ops'))
|
|
from aura_definition_profile import extend_with_package
|
|
from spell_passive_compat import fields,BUILD,SCHEMA
|
|
class PackageAuraTest(unittest.TestCase):
|
|
def fixture(self):
|
|
c=json.loads((ROOT/'docs/evidence/data/aura-profile/package-effect-extension.json').read_text())
|
|
return c['source'],dict(build=BUILD,schema=SCHEMA,rows=c['records']),fields(ROOT.parent/'tools/WoWDBDefs/definitions/SpellEffect.dbd','SpellEffect')
|
|
def test_source_single_effect_mask_preserves_base(self):
|
|
s,p,schema=self.fixture();base=[dict(spell=433,effect_index=0,aura_type=84,active_flags=1)];before=copy.deepcopy((base,s,p));rows=extend_with_package(base,s,p,schema)
|
|
self.assertEqual((base,s,p),before);self.assertEqual(rows[0],base[0]);self.assertEqual(rows[-1],dict(spell=s[0]['entry'],effect_index=0,aura_type=138,active_flags=1));self.assertEqual(extend_with_package(rows,s,p,schema),rows)
|
|
def test_wrong_source_wire_duplicate_or_multi_effect_rejected(self):
|
|
for kind in('wire','owner','aura','multiple','duplicate','status'):
|
|
s,p,schema=self.fixture();r=p['rows'][0]
|
|
if kind=='wire':r['wire_hex']='00'
|
|
elif kind=='owner':r['record']['SpellID']=3
|
|
elif kind=='aura':s[0]['effectApplyAuraName1']=3
|
|
elif kind=='multiple':s[0]['effect2']=6
|
|
elif kind=='duplicate':p['rows'].append(copy.deepcopy(r))
|
|
else:r['record_status']='removed'
|
|
with self.assertRaises(ValueError,msg=kind):extend_with_package([],s,p,schema)
|
|
if __name__=='__main__':unittest.main()
|