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

75 lines
3.6 KiB
Python

#!/usr/bin/env python3
"""Real Zanza definition regression plus masks that must remain unknown."""
import copy
import sys
import unittest
from pathlib import Path
sys.path.insert(0,str(Path(__file__).resolve().parents[1]/'ops'))
import aura_definition_profile as profile
def zanza():
row={'entry':24382,'script_name':'','mechanic':0,'effect1':6,'effect2':6,'effect3':0}
for n,stat in ((1,4),(2,2)):
row.update({f'effectApplyAuraName{n}':29,f'effectMechanic{n}':0,
f'effectBasePoints{n}':49,f'effectBaseDice{n}':1,
f'effectImplicitTargetA{n}':1,f'effectImplicitTargetB{n}':0,
f'effectRadiusIndex{n}':0,f'effectChainTarget{n}':0,
f'effectAmplitude{n}':0,f'effectTriggerSpell{n}':0,
f'effectMiscValue{n}':stat})
native=[{'ID':701184+i,'SpellID':24382,'EffectIndex':i,'DifficultyID':0,
'Effect':6,'EffectAura':29} for i in range(2)]
return row,native
class HomogeneousCasterModStatTests(unittest.TestCase):
def accepted(self,row,native):
return profile.generate([row],native,homogeneous_modstat_caster=True)
def test_actual_zanza_requires_opt_in_and_both_native_indices(self):
row,native=zanza()
self.assertEqual(profile.generate([row],native)['definitions'],[])
result=self.accepted(row,native)
self.assertEqual([(r['spell'],r['active_flags'],r['effect_indices'])
for r in result['definitions']],[(24382,3,[0,1])])
self.assertEqual(self.accepted(row,native[:1])['definitions'],[])
self.assertEqual(self.accepted(row,native+[native[0]])['definitions'],[])
wrong=copy.deepcopy(native);wrong[1]['EffectAura']=52
self.assertEqual(self.accepted(row,wrong)['definitions'],[])
difficult=copy.deepcopy(native);difficult[1]['DifficultyID']=1
self.assertEqual(self.accepted(row,difficult)['definitions'],[])
def test_source_predicate_script_target_and_lifecycle_divergences_hold(self):
row,native=zanza()
changes=[{'script_name':'scripted'}, {'effectApplyAuraName2':52},
{'effectMechanic2':1}, {'effectBasePoints2':-2},
{'effectImplicitTargetA1':6,'effectImplicitTargetA2':6},
{'effectAmplitude2':1000}, {'effectTriggerSpell2':123},
{'effectRadiusIndex1':1}, {'effectChainTarget2':2},
{'effectMiscValue2':5}]
for change in changes:
with self.subTest(change=change):
bad=dict(row,**change)
self.assertEqual(self.accepted(bad,native)['definitions'],[])
excluded=dict(row,entry=12567)
excluded_native=[dict(value,SpellID=12567) for value in native]
self.assertEqual(self.accepted(excluded,excluded_native)['definitions'],[])
missing=dict(row);missing.pop('script_name')
self.assertEqual(self.accepted(missing,native)['definitions'],[])
missing=dict(row);missing.pop('effectBaseDice2')
self.assertEqual(self.accepted(missing,native)['definitions'],[])
def test_native_checks_use_genuine_indices_and_support_three_effects(self):
row,native=zanza();row['effect3']=6
for key,value in list(row.items()):
if key.endswith('2') and key.startswith('effect') and key!='effect2':
row[key[:-1]+'3']=value
native.append(dict(native[1],ID=701186,EffectIndex=2))
self.assertEqual(self.accepted(row,native)['definitions'][0]['active_flags'],7)
with self.assertRaises(ValueError):
profile.generate([row],native,homogeneous_modstat_caster=1)
if __name__=='__main__':
unittest.main()