Skip to content

tests for FANPT - #212

Merged
rugwed-lokhande merged 10 commits into
mainfrom
test_fanpt_tests_new
Jun 10, 2026
Merged

tests for FANPT#212
rugwed-lokhande merged 10 commits into
mainfrom
test_fanpt_tests_new

Conversation

@rugwed-lokhande

Copy link
Copy Markdown
Contributor

Description

This PR updates and expands the FANPT test suite.

The existing tests/test_fanpt.py tests have been updated to use the newer PyCI/FanCI interface instead of the older convert_to_fanci workflow. The refactor now constructs the projected Schrödinger objective through ProjectedSchrodinger, builds the PyCI interface with legacy_fanci=False, and evaluates overlaps/objectives through the updated interface.

In addition, this PR adds several new unit test files for the FANPT container and updater components:

  • test_fanpt_container_base.py
  • test_fanpt_container_constant_terms.py
  • test_fanpt_container_energy_free.py
  • test_fanpt_container_energy_param.py
  • test_fanpt_container_updater.py
  • test_fanpt_fanpt.py

These tests use lightweight mock objects and monkeypatching to isolate FANPT logic from the full PyCI/FanCI backend where possible. The new tests cover container initialization behavior, derivative generation, constant-term construction, active-energy and energy-free branches, updater behavior, and high-level FANPT workflow logic.

Main Changes

  • Updated outdated FANPT tests to use the new PyCI interface.
  • Removed dependence on the older convert_to_fanci path in the affected tests.
  • Added unit tests for FANPT base container behavior.
  • Added tests for FANPT constant-term generation.
  • Added tests for energy-parameter and energy-free FANPT containers.
  • Added tests for FANPT updater behavior.
  • Added high-level tests for the FANPT driver logic using mocked dependencies.

Motivation

The FANPT tests were outdated relative to the current PyCI/FanCI interface. This PR brings the tests closer to the current code structure and adds more focused coverage for the FANPT container and updater modules. The added tests should make future refactoring safer by checking the main derivative, constant-term, and update pathways independently.

Notes

Some tests use simplified mock objects rather than full molecular calculations. This is intentional: the goal is to test FANPT control flow and algebraic behavior without requiring the full backend setup for every unit test.

@rugwed-lokhande
rugwed-lokhande requested a review from kzsigmond June 7, 2026 07:08
@kzsigmond

Copy link
Copy Markdown
Contributor

One of the fanpt tests is still importing convert_to_fanci, which is causing the tests to fail. Could you please take a look at it @rugwed-lokhande?

@rugwed-lokhande

Copy link
Copy Markdown
Contributor Author

One of the fanpt tests is still importing convert_to_fanci, which is causing the tests to fail. Could you please take a look at it @rugwed-lokhande?

done!

@kzsigmond kzsigmond left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the tests @rugwed-lokhande. I just have a couple of comments.
Also, just a general observation: you have sometimes FakeObjective, DummyContainer, etc. in multiple test files. Is there an overlap? If so, maybe having a utility file that all of the tests import things from would make a bit more sense. Then we only have to modify these fake and dummy objects at one place if the code changes.

Comment thread tests/test_fanpt.py Outdated
Comment thread tests/test_fanpt.py
Comment thread tests/test_fanpt_container_energy_free.py
Comment thread tests/test_fanpt_fanpt.py Outdated
Comment thread tests/test_fanpt_container_energy_param.py
Comment thread tests/test_fanpt_container_updater.py Outdated
@rugwed-lokhande
rugwed-lokhande merged commit aa2fd25 into main Jun 10, 2026
3 checks passed
@kzsigmond kzsigmond linked an issue Jun 10, 2026 that may be closed by this pull request
2 tasks
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.

Test: outdated fanpt tests

2 participants