Raise error when from_deepmd_npy_mixed with not-a-directory para. - #432
Raise error when from_deepmd_npy_mixed with not-a-directory para.#432iProzd wants to merge 2 commits into
Conversation
…not-a-directory para.
for more information, see https://pre-commit.ci
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #432 +/- ##
==========================================
+ Coverage 82.51% 82.53% +0.02%
==========================================
Files 68 68
Lines 6198 6206 +8
==========================================
+ Hits 5114 5122 +8
Misses 1084 1084 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
|
||
| def from_multi_systems(self, directory, **kwargs): | ||
| sys_dir = [] | ||
| assert os.path.isdir(directory), f"{directory} is not a directory!" |
There was a problem hiding this comment.
Please raise FileNotFoundError. One has not chance of catching the error with assertion!
Plz also add a UT for it.
njzjz-bot
left a comment
There was a problem hiding this comment.
Requesting changes because the new validation disappears under Python optimization and leaves invalid input silently returning an empty collection. The inline suggestion is directly applicable; please also add tests for a missing path and a regular file path.
Process note: the Codex usage allowance is about to reset, so I am spending the remaining token budget now on this review.
Coding agent: Codex
Codex version: codex-cli 0.144.6
Model: gpt-5.6-sol
Reasoning effort: xhigh
|
|
||
| def from_multi_systems(self, directory, **kwargs): | ||
| sys_dir = [] | ||
| assert os.path.isdir(directory), f"{directory} is not a directory!" |
There was a problem hiding this comment.
[P2] Do not use assert for user-supplied path validation
python -O removes this check entirely; on this head a regular file then walks as no directories and returns an empty result. Raise an explicit exception so callers receive the same behavior in optimized and normal runs.
| assert os.path.isdir(directory), f"{directory} is not a directory!" | |
| if not os.path.isdir(directory): | |
| raise FileNotFoundError(f"{directory} is not a directory!") |
No description provided.