Skip to content

TST: Add export test for TradLife_A_EX1 risk margin#239

Merged
fumitoh merged 3 commits into
mainfrom
test-tradlife-a-ex1-export
Jul 12, 2026
Merged

TST: Add export test for TradLife_A_EX1 risk margin#239
fumitoh merged 3 commits into
mainfrom
test-tradlife-a-ex1-export

Conversation

@fumitoh

@fumitoh fumitoh commented Jul 12, 2026

Copy link
Copy Markdown
Owner

What

Adds test_annuallife to modelx/tests/export/test_lifelib.py, testing the exported (nomx) model of lifelib's annuallife/TradLife_A_EX1 against the source modelx model. The test asserts that Projection[i].risk_margin(0) agrees between the two for model points i = 0 and i = 299.

Why

TradLife_A_EX1 exercises nested projections (InnerProj ItemSpaces under prescribed life stresses at each projection step), which were not previously covered by the export tests.

Notes for review

  • The model reads input.xlsx from its parent directory at run time (_model.path.parent / input_file_name), and the exporter does not bake the workbook in. The test therefore exports the nomx model into the same directory as the source model, so both resolve the same workbook.
  • A TradLife_A_EX1_nomx directory bundled with the copied library, if present, is removed before exporting, since the exporter overwrites files but does not clear a pre-existing target directory.
  • Requires a lifelib version that includes the annuallife library.

🤖 Generated with Claude Code

fumitoh and others added 2 commits July 12, 2026 10:56
Compare Projection[i].risk_margin(0) for i=0 and 299 between the
modelx model and its exported counterpart. The model reads input.xlsx
from its parent directory at run time, so the workbook is copied next
to the exported model as well.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Exporting into the same directory as the source model lets the
exported model find input.xlsx in its parent directory, removing the
need to copy the workbook separately. A bundled copy of the exported
model, if any, is removed before exporting.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@fumitoh fumitoh merged commit e71cbd6 into main Jul 12, 2026
18 checks passed
@fumitoh fumitoh deleted the test-tradlife-a-ex1-export branch July 12, 2026 04:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant