883 files, from working commit b1a079a. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
59 lines
3.0 KiB
Python
59 lines
3.0 KiB
Python
#!/usr/bin/env python3
|
|
"""One source aura plus immediate effects does not imply multiple aura bits."""
|
|
import copy
|
|
from pathlib import Path
|
|
import sys
|
|
import unittest
|
|
sys.path.insert(0,str(Path(__file__).resolve().parents[1]/'ops'))
|
|
from aura_definition_profile import generate
|
|
|
|
|
|
def source(ident=7373,effects=(2,6,0),kind=33):
|
|
row=dict(entry=ident)
|
|
for i,effect in enumerate(effects,1):row['effect'+str(i)]=effect;row['effectApplyAuraName'+str(i)]=kind if effect==6 else 0
|
|
return row
|
|
|
|
|
|
def native(ident=7373,index=1,kind=33):
|
|
return dict(SpellID=ident,EffectIndex=index,DifficultyID=0,Effect=6,EffectAura=kind)
|
|
|
|
|
|
class AuraCompanionTest(unittest.TestCase):
|
|
def test_existing_conservative_policy_stays_opt_in(self):
|
|
self.assertEqual(generate([source()],[native()])['definitions'],[])
|
|
|
|
def test_all_three_slots_and_reviewed_immediate_companions(self):
|
|
for index in range(3):
|
|
for instant in(2,10,30):
|
|
effects=[0,0,0];effects[index]=6;effects[(index+1)%3]=instant
|
|
result=generate([source(effects=effects)],[native(index=index)],instant_companions=True)
|
|
self.assertEqual(result['definitions'],[dict(spell=7373,effect_index=index,aura_type=33,active_flags=1<<index)])
|
|
|
|
def test_real_stun_and_crusader_shapes_without_specific_id_branches(self):
|
|
sources=[source(12809,(6,2,30),12),source(20007,(6,10,0),29),source(20549,(6,0,0),12)]
|
|
native_rows=[native(r['entry'],0,r['effectApplyAuraName1'])for r in sources]
|
|
result=generate(sources,native_rows,instant_companions=True)
|
|
self.assertEqual([r['spell']for r in result['definitions']],[12809,20007,20549])
|
|
self.assertTrue(all(r['active_flags']==1 for r in result['definitions']))
|
|
|
|
def test_multi_aura_unknown_companions_and_unreviewed_semantics_refused(self):
|
|
for effects,kind in[((6,6,0),33),((2,6,35),33),((2,6,64),33),((2,6,0),319),((2,6,0),0)]:
|
|
result=generate([source(effects=effects,kind=kind)],[native(kind=kind)],instant_companions=True)
|
|
self.assertEqual(result['definitions'],[])
|
|
|
|
def test_wrong_index_aura_effect_difficulty_and_duplicate_rows_refused(self):
|
|
for field,value in [('EffectIndex',0),('EffectAura',138),('Effect',2),('DifficultyID',1)]:
|
|
row=native();row[field]=value
|
|
self.assertEqual(generate([source()],[row],instant_companions=True)['definitions'],[])
|
|
self.assertEqual(generate([source()],[native(),native()],instant_companions=True)['definitions'],[])
|
|
|
|
def test_batch_is_deterministic_and_does_not_mutate_inputs(self):
|
|
sources=[source(20007,(6,10,0),29),source()];rows=[native(20007,0,29),native()]
|
|
before=copy.deepcopy((sources,rows));a=generate(sources,rows,instant_companions=True)
|
|
self.assertEqual(a,generate(list(reversed(sources)),list(reversed(rows)),instant_companions=True))
|
|
self.assertEqual((sources,rows),before)
|
|
with self.assertRaises(ValueError):generate(sources,rows,instant_companions=1)
|
|
|
|
|
|
if __name__=='__main__':unittest.main()
|