883 files, from working commit b1a079a. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
52 lines
2.3 KiB
Python
52 lines
2.3 KiB
Python
"""Text-only item corrections preserve distinct native proc execution metadata."""
|
|
import copy
|
|
import sys
|
|
import unittest
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
sys.path[:0] = [str(ROOT / 'ops'), str(ROOT / 'tests')]
|
|
import existing_restorative_proc_test as fixtures
|
|
import spell_item_proc_compat as proc
|
|
|
|
|
|
class RestorativeProcPresentationTest(unittest.TestCase):
|
|
def fixture(self, *, presentation=True, override=True):
|
|
values, schemas = fixtures.ExistingRestorativeProcTest().fixture(not override)
|
|
values['presentation_only'] = presentation
|
|
row = next(r for r in values['native']['SpellAuraOptions']
|
|
if r['SpellID'] == 27419)
|
|
row.update(ProcChance=99, ProcTypeMask=[20, 0])
|
|
return values, schemas
|
|
|
|
def test_presentation_only_defers_chance_and_events_without_mutation(self):
|
|
values, schemas = self.fixture()
|
|
before = copy.deepcopy(values)
|
|
result = proc.existing_restoration_component(**values, schemas=schemas)
|
|
self.assertEqual(values, before)
|
|
self.assertTrue(result['records'])
|
|
self.assertEqual({r['table_name'] for r in result['records']}, {'Spell'})
|
|
deferred = next(r for r in result['deferred_metadata_corrections']
|
|
if r['table_name'] == 'SpellAuraOptions')
|
|
self.assertEqual(deferred['changed_fields'], ['ProcChance', 'ProcTypeMask'])
|
|
self.assertFalse(result['proc_execution_rules_converted'])
|
|
self.assertFalse(result['installed'])
|
|
|
|
def test_full_conversion_rejects_differing_conditions_even_without_override(self):
|
|
values, schemas = self.fixture(presentation=False, override=False)
|
|
with self.assertRaisesRegex(ValueError, 'proc conditions differ'):
|
|
proc.existing_restoration_component(**values, schemas=schemas)
|
|
|
|
def test_text_scope_rejects_unreviewed_execution_fields_or_shape(self):
|
|
for field in ('ProcCategoryRecovery', 'UnreviewedField'):
|
|
values, schemas = self.fixture()
|
|
row = next(r for r in values['native']['SpellAuraOptions']
|
|
if r['SpellID'] == 27419)
|
|
row[field] = 100
|
|
with self.assertRaisesRegex(ValueError, 'proc conditions differ'):
|
|
proc.existing_restoration_component(**values, schemas=schemas)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
unittest.main()
|