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

53 lines
2.9 KiB
Python

#!/usr/bin/env python3
"""Actual negative flat-modifier operand and exact retained-mask boundary."""
import json
import sys
import unittest
from copy import deepcopy
from pathlib import Path
sys.path.insert(0, str(Path(__file__).resolve().parents[1] / 'ops'))
from spell_item_proc_compat import existing_restoration_component
class Flat107OperandRoleTest(unittest.TestCase):
def test_actual_signed_operand_and_identity_refusals(self):
fixture = json.loads((Path(__file__).parent / 'fixtures/native-original-flat107-operand.json').read_text())
unchanged = deepcopy(fixture)
def build(native=None, affect=None, **flags):
return existing_restoration_component([fixture['source']], native or fixture['native'], fixture['schemas'],
proc_proof=None, proc_overrides=None, duration_reference=None,
flat_aura107_operands_only=True, affect_context=affect or fixture['affect_context'], **flags)
result = build()
self.assertEqual(len(result['records']), 1)
row = result['records'][0]
self.assertEqual(row['changed_fields'], ['EffectBasePointsF'])
self.assertEqual(row['record']['EffectBasePointsF'], fixture['expected_source_amount'])
self.assertEqual(row['baseline_record']['EffectBasePointsF'], fixture['expected_original_amount'])
self.assertLess(row['record']['EffectBasePointsF'], 0)
self.assertEqual({k:v for k,v in row['record'].items() if k != 'EffectBasePointsF'},
{k:v for k,v in row['baseline_record'].items() if k != 'EffectBasePointsF'})
self.assertEqual(fixture, unchanged)
self.assertFalse(result['spells'][0]['complete_source_definition'])
self.assertFalse(result['spells'][0]['spell_modifier_application_verified'])
target = fixture['affect_context']['slots'][0]
native = deepcopy(fixture['native'])
effect = next(r for r in native['SpellEffect'] if r['EffectIndex'] == target['effect_index'] and r['DifficultyID'] == 0)
effect['EffectSpellClassMask'][0] ^= 1
with self.assertRaisesRegex(ValueError, 'original native constant self tuple'):
build(native=native)
affect = deepcopy(fixture['affect_context']); affect['snapshot']['equal'] = False
with self.assertRaisesRegex(ValueError, 'Pinned equal read-only affect snapshot'):
build(affect=affect)
affect = deepcopy(fixture['affect_context']); affect['namespace']['operations'][0]['target_value'] += 1
with self.assertRaisesRegex(ValueError, 'reviewed modifier namespace'):
build(affect=affect)
native = deepcopy(fixture['native']); native['SpellMisc'][0]['Attributes'][1] ^= 1
with self.assertRaisesRegex(ValueError, 'attribute retention witness'):
build(native=native)
with self.assertRaisesRegex(ValueError, 'One typed'):
build(aura161_operands_only=True)
if __name__ == '__main__':
unittest.main()