Skip to content

Add docstrings and comprehensive tests for models and optimizer - #16

Merged
niklashoelter merged 2 commits into
masterfrom
docstrings-and-tests-1878505356613482669
Feb 2, 2026
Merged

niklashoelter merged 2 commits into
masterfrom
docstrings-and-tests-1878505356613482669

Conversation

@niklashoelter

Copy link
Copy Markdown
Owner

This PR addresses the user request to ensure all functions are properly documented and that the test suite covers all functionalities.

Changes:

  1. Docstrings: Added missing docstrings in src/gpuma/config.py. Verified that other core modules (optimizer.py, models.py, etc.) have appropriate docstrings.
  2. Test Environment: Fixed tests/conftest.py to properly mock nested dependencies like rdkit.Chem and ase.optimize, resolving issues where mocks were not correctly linked to their parent modules. This ensures tests run correctly in environments without heavy dependencies installed.
  3. New Tests:
    • Optimizer: Added tests/test_optimizer_module.py with tests for optimize_single_structure (verifying ASE integration) and optimize_structure_batch (verifying both sequential and GPU-accelerated batch modes). Mocks torch_sim and ase appropriately.
    • Models: Enhanced tests/test_models_module.py to test load_model_fairchem and load_model_torchsim, verifying cache directory usage, model path loading, and HF token handling via environment variables.

All tests (42 items) pass successfully. numpy is installed in the test environment and is not mocked.


PR created automatically by Jules for task 1878505356613482669 started by @niklashoelter

…er modules

- Added docstrings to `src/gpuma/config.py` for `_Section` and `Config` classes.
- Enhanced `tests/conftest.py` to correctly link mocked submodules for `ase`, `fairchem`, `morfeus`, and `rdkit`.
- Implemented comprehensive tests in `tests/test_optimizer_module.py` covering single structure and batch optimization (sequential and batch modes), mocking `ase` and `torch_sim` interactions.
- Added detailed tests in `tests/test_models_module.py` for model loading, caching behavior, and environment configuration.
- Fixed `tests/test_mol_utils.py` failure caused by incorrect mocking of `rdkit`.

Co-authored-by: niklashoelter <83964137+niklashoelter@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

…er modules

- Added docstrings to `src/gpuma/config.py` for `_Section` and `Config` classes.
- Enhanced `tests/conftest.py` to correctly link mocked submodules for `ase`, `fairchem`, `morfeus`, and `rdkit`.
- Implemented comprehensive tests in `tests/test_optimizer_module.py` covering single structure and batch optimization (sequential and batch modes), mocking `ase` and `torch_sim` interactions.
- Added detailed tests in `tests/test_models_module.py` for model loading, caching behavior, and environment configuration.
- Fixed `tests/test_mol_utils.py` failure caused by incorrect mocking of `rdkit`.
- Linted tests to comply with project style guidelines.
- Ensured tests properly mock network calls to avoid CI failures with gated Hugging Face repos.

Co-authored-by: niklashoelter <83964137+niklashoelter@users.noreply.github.com>
@niklashoelter
niklashoelter merged commit 07ab1ff into master Feb 2, 2026
1 check passed
@niklashoelter
niklashoelter deleted the docstrings-and-tests-1878505356613482669 branch February 2, 2026 15:04
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