Skip to content

Add failing test case for issue #549 (empty Importance object print)#681

Merged
kordusas merged 24 commits intoidaholab:alpha-test-devfrom
kordusas:fix-blank-importance-printing-549
Mar 27, 2025
Merged

Add failing test case for issue #549 (empty Importance object print)#681
kordusas merged 24 commits intoidaholab:alpha-test-devfrom
kordusas:fix-blank-importance-printing-549

Conversation

@kordusas
Copy link
Collaborator

@kordusas kordusas commented Mar 8, 2025

Pull Request Checklist for MontePy

Description

Previously Importance class had a place holder for printing and failed on empty object instance. Now Importance printing is formatted like this: IMPORTANCE: neutron=1.0, photon=1.0

Empty object instance printing looks like this: IMPORTANCE: Object is empty

Reformated the test_importance.py now using @pytest.mark.parametrize and removed dependence on TestCase object.

  • test_importance_parsing_from_cell checks if valid values are initiated or valid error is raised when creating Cell instance and getting the importance instance from the
  • test_importance_init_data_valid tests init of importance from DATA block and testing access to it
  • test_importance_init_data_invalid - testing invalid importance object instance init
  • added fixtures for cell_with_importance , empty_cell, test_importance_values to reuse same cells and same particle and importance assingments
  • test_str_repr_parsed_cells checks that methods return valid type
  • test_str_repr_empty_importance checks that empty importance object returns whats expected
  • test_importance_manual_assignment_and_str_repr - tests manual assignment of importance and the correct strrepresentation of the importance instance

Fixes #549


General Checklist

  • I have performed a self-review of my own code.
  • The code follows the standards outlined in the development documentation.
  • I have formatted my code with black version 25.
  • I have added tests that prove my fix is effective or that my feature works (if applicable).

Documentation Checklist

  • I have documented all added classes and methods.
  • For infrastructure updates, I have updated the developer's guide.
  • For significant new features, I have added a section to the getting started guide.

First-Time Contributor Checklist

  • If this is your first contribution, add yourself to pyproject.toml if you wish to do so.

Additional Notes for Reviewers

Ensure that:

  • The submitted code is consistent with the merge checklist outlined here.
  • The PR covers all relevant aspects according to the development guidelines.
  • 100% coverage of the patch is achieved, or justification for a variance is given.

📚 Documentation preview 📚: https://montepy--681.org.readthedocs.build/en/681/

@MicahGale MicahGale self-requested a review March 8, 2025 19:11
@MicahGale MicahGale self-assigned this Mar 8, 2025
@MicahGale MicahGale added the bugs A deviation from expected behavior that does not reach the level of being reportable as an "Error". label Mar 8, 2025
Copy link
Collaborator

@MicahGale MicahGale left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution @kordusas!

This is a good first pass but some changes are needed. I left comments on specific changes.

  1. Update the PR description to give a summary of what the problem that was solved is, and how it was solved. Also link to the specific issues. See #680 for an example.
  2. Do you want to add yourself as an author to AUTHORS and/or pyproject.toml?
  3. Make sure to update the changelog with this bug fix.
  4. Would you like to added as a contributor to this repo on GH?

@MicahGale MicahGale marked this pull request as draft March 8, 2025 20:06
@MicahGale
Copy link
Collaborator

@kordusas do you need any help with this PR?

@MicahGale MicahGale marked this pull request as ready for review March 24, 2025 13:24
Copy link
Collaborator

@MicahGale MicahGale left a comment

Choose a reason for hiding this comment

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

I like what you have done with this __str__ style.

Also thank you for handling the conversion of unittest->pytest for this test suite, it wasn't essential for this PR, but is a huge help.

@MicahGale MicahGale added CI/CD code improvement A feature request that will improve the software and its maintainability, but be invisible to users. labels Mar 24, 2025
@MicahGale
Copy link
Collaborator

FYI: this will probably be deployed in 1.0.0, and not 0.5.6... hopefully. I'm hoping that we are really close to completing 1.0.0 release.

@kordusas
Copy link
Collaborator Author

FYI: this will probably be deployed in 1.0.0, and not 0.5.6... hopefully. I'm hoping that we are really close to completing 1.0.0 release.

Should i wait for the 1.0.0 to come out before submitting another pull request?

@MicahGale
Copy link
Collaborator

FYI: this will probably be deployed in 1.0.0, and not 0.5.6... hopefully. I'm hoping that we are really close to completing 1.0.0 release.

Should i wait for the 1.0.0 to come out before submitting another pull request?

Handling the merge conflicts wouldn't be the biggest deal. What you can do though is make new branches off of alpha-test-dev instead of develop.

@MicahGale MicahGale assigned kordusas and unassigned MicahGale Mar 24, 2025
@MicahGale MicahGale changed the base branch from develop to alpha-test-dev March 25, 2025 00:02
@MicahGale MicahGale changed the base branch from alpha-test-dev to develop March 25, 2025 00:02
@kordusas kordusas force-pushed the fix-blank-importance-printing-549 branch from 458bc4f to d6f8e2d Compare March 27, 2025 13:09
@kordusas kordusas changed the base branch from develop to alpha-test-dev March 27, 2025 13:28
@kordusas
Copy link
Collaborator Author

FYI: this will probably be deployed in 1.0.0, and not 0.5.6... hopefully. I'm hoping that we are really close to completing 1.0.0 release.

Should i wait for the 1.0.0 to come out before submitting another pull request?

Handling the merge conflicts wouldn't be the biggest deal. What you can do though is make new branches off of alpha-test-dev instead of develop.

I have rebased it to alpha-test-dev, let me know if I didnt follow some procedures, I will adress the rest of the changes this week.

Cheers

Copy link
Collaborator

@MicahGale MicahGale left a comment

Choose a reason for hiding this comment

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

This is looking good. Just one small tweak. Thanks for the contribution. If you have permissions you can merge when you are ready (we prefer merging over other options).

Co-authored-by: Micah Gale <mgale@fastmail.com>
@kordusas kordusas merged commit 366d87d into idaholab:alpha-test-dev Mar 27, 2025
24 checks passed
@kordusas kordusas deleted the fix-blank-importance-printing-549 branch April 15, 2025 15:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugs A deviation from expected behavior that does not reach the level of being reportable as an "Error". CI/CD code improvement A feature request that will improve the software and its maintainability, but be invisible to users.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Blank importance objects can't be printed

2 participants