Skip to content

status: add automated test suite focused on energy calculations - #139

Open
t-kramer wants to merge 5 commits into
developmentfrom
#132-testing-scheme
Open

status: add automated test suite focused on energy calculations#139
t-kramer wants to merge 5 commits into
developmentfrom
#132-testing-scheme

Conversation

@t-kramer

Copy link
Copy Markdown
Collaborator

We had zero automated tests for src/energy.py, the core calculatiom, and were relying on a hand-checked spreadsheet after every change. This PR adds 88 tests across three tiers (fast unit tests on commit, regression snapshots on every push, full 8760h smoke tests before deployment).

For context on the design decisions and how to work with the tests day-to-day, see notes/testing-scheme.md. That's the right place to start rather than the test files themselves.

@t-kramer
t-kramer requested review from praftery and urwahah July 22, 2026 15:27
@t-kramer t-kramer self-assigned this Jul 22, 2026
@t-kramer t-kramer added enhancement New feature or request CALNext In scope of CALNext project labels Jul 22, 2026
@urwahah

urwahah commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator

thanks so much for all this work!! it looks super comprehensive. i have a few questions:

  1. i'm not sure i understand the emissions rate and physics invariant tests in the tier 1 test_energy_unit.py. they aren't checking anything in energy.py - all these tests confirm is that the formulas provided in the tests are correct. if there was somehow an error in these particular calculations in the main code, i don't get how this would catch it?
  2. there is a test to check that negative load values are allowed in test_loads.py. i don't know if that should be allowed? i believe the way our HR calculations are set up, the HR served load would just go to 0 if it encounters a negative load number (because of the minimum turndown), but regardless i don't know where a negative load value would be an acceptable input
  3. should we have at least one test case building with measured data instead of simulated?
  4. i'm unfamiliar with the testing setup so maybe an easy solution to this.. what's a good way of reviewing the differences in the regression snapshots once a change is made? i tested out the process of updating the snapshot and running git diff but that returns just an illegible output:
image

@t-kramer t-kramer linked an issue Jul 29, 2026 that may be closed by this pull request
@t-kramer t-kramer removed a link to an issue Jul 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CALNext In scope of CALNext project enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants