Extend unit tests for get_primitive_cell()#485
Conversation
Added test cases to cover: - Periodic boundary condition validation: ensuring ValueError is raised if structure is not periodic. - Custom arrays warning: ensuring a warning is logged when custom arrays are present in the source structure. Co-authored-by: jan-janssen <3854739+jan-janssen@users.noreply.github.com>
|
👋 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 New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## standardize #485 +/- ##
===============================================
+ Coverage 82.84% 82.94% +0.10%
===============================================
Files 26 26
Lines 1859 1859
===============================================
+ Hits 1540 1542 +2
+ Misses 319 317 -2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR extends unit test coverage around Symmetry.get_primitive_cell() to ensure expected validation and logging behavior is exercised in structuretoolkit.analyse.symmetry.
Changes:
- Added a unit test asserting a
ValueErroris raised when the input structure is not fully periodic (pbcnot allTrue). - Added a unit test asserting a warning is logged when custom
Atoms.arraysentries won’t be preserved in the primitive cell.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| structure = bulk("Al", cubic=True) | ||
| structure.pbc = [True, True, False] | ||
| sym = stk.analyse.get_symmetry(structure=structure) | ||
| with self.assertRaisesRegex(ValueError, "Can only symmetrize periodic structures."): |
There was a problem hiding this comment.
assertRaisesRegex treats the pattern as a regular expression; the trailing . in the message currently matches any character. If the intent is to assert the exact message (including the period), consider escaping/anchoring the pattern (e.g., escape the dot and use ^...$) so the test can’t pass on slightly different messages.
| with self.assertRaisesRegex(ValueError, "Can only symmetrize periodic structures."): | |
| with self.assertRaisesRegex( | |
| ValueError, r"^Can only symmetrize periodic structures\.$" | |
| ): |
This PR extends the unit tests for the
get_primitive_cell()function insrc/structuretoolkit/analyse/symmetry.py.The new tests in
tests/test_analyse_symmetry.pyverify:ValueErrorwith the message "Can only symmetrize periodic structures." is raised when the input structure does not have all periodic boundary conditions set toTrue.These additions ensure better coverage of the validation and notification logic within
get_primitive_cell().PR created automatically by Jules for task 17824912344481522576 started by @jan-janssen