remove diagnostic timestamp test overlaping another#965
remove diagnostic timestamp test overlaping another#965nicolasaunai wants to merge 1 commit intoPHAREHUB:masterfrom
Conversation
📝 WalkthroughWalkthroughThis pull request removes an unnecessary test method and refines an existing one in the diagnostics test suite. The removed method was responsible for checking diagnostic timestamp dumps, while the retained method now includes a clarifying docstring and updated variable names. The changes improve the clarity of the test logic for dumping diagnostic timestamps, particularly for the "B" quantity, by altering loop variables and the logic used for generating timestamps. Changes
Sequence Diagram(s)sequenceDiagram
participant T as Test Method
participant D as Diagnostic Engine
participant H as HDF5 Handler
T->>D: Initialize diagnostic setup (with refinement boxes)
T->>D: Begin loop using 'skip_init' and 'diag_cadence'
D-->>T: Generate diagnostic timestamp based on cadence
T->>H: Format and compare generated timestamp
T->>T: Assert equality with expected timestamp output
Possibly related PRs
Suggested reviewers
✨ Finishing Touches
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
tests/simulator/test_diagnostic_timestamps.py(2 hunks)
🧰 Additional context used
🪛 Ruff (0.8.2)
tests/simulator/test_diagnostic_timestamps.py
140-140: Undefined name i
(F821)
⏰ Context from checks skipped due to timeout of 90000ms (6)
- GitHub Check: build (macos-latest)
- GitHub Check: Analyze (cpp)
- GitHub Check: build (macos-14)
- GitHub Check: Analyze (python)
- GitHub Check: build (macos-13)
- GitHub Check: build (ubuntu-latest)
🔇 Additional comments (2)
tests/simulator/test_diagnostic_timestamps.py (2)
108-121: LGTM! Clear and comprehensive docstring.The docstring effectively explains the test's purpose, conditions, and verification steps.
129-130: LGTM! More descriptive variable names.The variable renaming from
trailingtoskip_initanditodiag_cadenceimproves code readability by better reflecting their purpose.
| setup_model(10) | ||
|
|
||
| timestamps = np.arange(0, final_time, time_step * i)[trailing:] | ||
| timestamps = np.arange(0, final_time, time_step * i)[skip_init:] |
There was a problem hiding this comment.
Fix undefined variable error.
The variable i is undefined. It should be diag_cadence to match the loop variable name.
Apply this diff to fix the undefined variable:
- timestamps = np.arange(0, final_time, time_step * i)[skip_init:]
+ timestamps = np.arange(0, final_time, time_step * diag_cadence)[skip_init:]📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| timestamps = np.arange(0, final_time, time_step * i)[skip_init:] | |
| timestamps = np.arange(0, final_time, time_step * diag_cadence)[skip_init:] |
🧰 Tools
🪛 Ruff (0.8.2)
140-140: Undefined name i
(F821)
|
This test was made to run for a long time to make sure we do not have rounding errors in the way the time is set in PHARE. Before, time was incrementally increase by dt, leading to rounding errors, leading to key errors while reading diags. Now with the ConstantTimeStamper, we iterate the time INDEX and get the current time increment from start time, which removes the rounding error. |
Maybe it was useful for something... but I can't tell what just by looking at it.
It's going further in time that the second test but it's testing more or less the same thing.
If really needed we can probably make the second test run further too (?) but the reason needs to be explained I think.