Skip to content

Conversation

@tjlaboss
Copy link
Collaborator

@tjlaboss tjlaboss commented Jan 13, 2026

Pull Request Checklist for MontePy

Description

  • Add object support for S, SX, SY, SZ, SO, similar to the cylinder and plane support.
  • Minor surface infrastructure updates

Fixes #876 (issue number)


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).

LLM Disclosure

Were any large language models (LLM or "AI") used in to generate any of this code?

  • Yes
    • Model(s) used:
  • No

Documentation Checklist

  • I have documented all added classes and methods.

Additional Notes for Reviewers

Ensure that:

  • This PR fully addresses and resolves the referenced issue(s).
  • 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.

Discussion

Spheres aren't candidates for periodic surfaces. I deleted duplicate surface checking related to that: please review carefully. There is a lot of copypasta for surface infrastructure that would be candidates for kicking up the Surface class or some other intermediate class.


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

@tjlaboss tjlaboss changed the title Baller Support Spheres Jan 13, 2026
@tjlaboss tjlaboss requested a review from MicahGale January 13, 2026 21:24
@tjlaboss
Copy link
Collaborator Author

I got the coverage up enough to pass, but think that .find_duplicate_surfaces() should be reevaluated in the future (#878).

@MicahGale
Copy link
Collaborator

I got the coverage up enough to pass, but think that .find_duplicate_surfaces() should be reevaluated in the future (#878).

I'm not going to merge such a big untested function. Before #878 you could just return an empty list.

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 going to be fun to merge into minor_rel_dev

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.

Changes should be marked with the version the objects were added.

Also patch coverage is < 100%. I think you need to look into the validation testing some more.

if self.location is None:
raise IllegalState(f"Surface: {self.number} does not have a location set.")

def find_duplicate_surfaces(self, surfaces, tolerance):
Copy link
Collaborator

Choose a reason for hiding this comment

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

add a # pragma: no cover

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Not sure why these IllegalState paths aren't getting tested in test_surfaces.py

Copy link
Collaborator

Choose a reason for hiding this comment

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

Sorry I mean for find_duplicate_surfaces, not for the IllegalState ones.

@tjlaboss tjlaboss requested a review from MicahGale January 14, 2026 19:51
@tjlaboss
Copy link
Collaborator Author

Ready for re-review.

Changed in version 9.0: The versionadded directive was renamed to version-added. The previous name is retained as an alias.
@tjlaboss tjlaboss enabled auto-merge (squash) January 15, 2026 16:12
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.

Gotta have more coverage.

if self.location is None:
raise IllegalState(f"Surface: {self.number} does not have a location set.")

def find_duplicate_surfaces(self, surfaces, tolerance):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Sorry I mean for find_duplicate_surfaces, not for the IllegalState ones.

with pytest.raises(IllegalState):
surf.format_for_mcnp_input(vers)
# sphere on axis
surf = SphereOnAxis(number=5)
Copy link
Collaborator

Choose a reason for hiding this comment

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

All of these are getting caught by the parent class validate which requires a set surface_type. After the first validate call set surface_type.

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.

Add Sphere support

3 participants