Repository navigation
Add get_by_comment method to NumberedObjectCollection - #1006
digvijay-y wants to merge 6 commits into
Conversation
…ng tests - Implemented a method to yield objects matching a comment string or regex pattern. - Added unit tests to validate functionality and error handling for the new method.
Signed-off-by: DIGVIJAY <144053736+digvijay-y@users.noreply.github.com>
|
The test failure isn't your fault, but could you fix it while you have a PR open? The problem is that setuptools-scm changed their website structure. Could you change: https://setuptools-scm.readthedocs.io/en/latest/ to https://setuptools-scm.readthedocs.io/latest/ in the documentation? |
MicahGale
left a comment
There was a problem hiding this comment.
This is looking pretty good. Only that needs changed for sure is the changelog. Otherwise let's discuss the other concerns I had.
| cp_simple_problem.materials.check_number(-1) | ||
|
|
||
| def test_get_by_comment(self): | ||
| problem = montepy.read_input(os.path.join("tests", "inputs", "pin_cell.imcnp")) |
There was a problem hiding this comment.
Is there a reason to use this test case over the test.imcnp given by the fixture read_simple_problem? I haven't looked at how many comments there are recently.
There was a problem hiding this comment.
@digvijay-y is there a reason you can't just the text fixture here?
MicahGale
left a comment
There was a problem hiding this comment.
Looking good overall. Patch coverage looks to be 100%. Just need to resolve that broken link discussion from earlier, and the one question I had about the test case.
MicahGale
left a comment
There was a problem hiding this comment.
Just need to discuss if a test fixture could be used instead for the test.
|
I can test with it and see how it works.
…On Tue, 6 Oct, 2026, 21:21 Micah Gale, ***@***.***> wrote:
***@***.**** commented on this pull request.
Just need to discuss if a test fixture could be used instead for the test.
—
Reply to this email directly, view it on GitHub
<#1006?email_source=notifications&email_token=BCLBL2AGZ6SMDGOHKKIZPWT5SUIHNA5CNFSNUABKM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UKJSXM2LFO4XTKNBTGEYDOMJWGYY2M4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJLDGN5XXIZLSL5RWY2LDNM#pullrequestreview-5431071661>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BCLBL2DCQ3VLWVE5QI6EGW35SUIHNAVCNFSNUABFKJSXA33TNF2G64TZHM3TIMJSGEYTGMBYHNEXG43VMU5TKMJRGI2TCOBUHE32C5QC>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
There was a problem hiding this comment.
🟡 Changes recommended
Required version metadata is missing from the affected public APIs.
1 open finding
What changed in this PR
Adds comment-based lookup to NumberedObjectCollection, including literal and regex matching.
Changes:
- Added
get_by_comment. - Added text, regex, byte-regex, and error-handling tests.
- Updated comment searching support and changelog documentation.
| File | Reviewed changes |
|---|---|
tests/test_syntax_parsing.py |
Tests byte-regex behavior. |
tests/test_numbered_collection.py |
Tests comment-based lookup. |
montepy/numbered_object_collection.py |
Adds get_by_comment. |
montepy/comments.py |
Supports byte-compiled regexes. |
doc/source/dev_standards.rst |
Updates documentation links. |
doc/source/changelog.rst |
Records the new feature. |
🧠 Review effort: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| """Yield all objects whose comments match the given text or pattern. | ||
|
|
||
| The search is applied to each object's |

Pull Request Checklist for MontePy
Description
Fixes #982
General Checklist
blackversion 25 or 26.LLM Disclosure
Are you?
Were any large language models (LLM or "AI") used in to generate any of this code?
Documentation Checklist
.. versionchanged::or.. versionadded::directives.Infrastructure Changes
Significant features or Behavior changes
First-Time Contributor Checklist
pyproject.tomlif you wish to do so.Additional Notes for Reviewers
Ensure that:
📚 Documentation preview 📚: https://montepy--1006.org.readthedocs.build/en/1006/