Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pull Request
Description
This PR refactors the TimeWindowMixin class to improve validation logic for interval start and end times, ensuring they adhere to the specified constraints. It fixes issues where invalid intervals or divisibility violations were not being properly handled. The validation errors now properly trigger when an invalid configuration is provided. Additionally, the test cases for these validations were added to ensure robustness and accuracy.
Fixes #157
How Has This Been Tested?
The changes were tested using unit tests. The following tests were run to verify the new validation logic:
Valid Time Window Test:
A valid configuration where interval_start_minutes and interval_end_minutes satisfy the correct conditions.
Expected behavior: No errors raised, test passed.
Invalid Time Window Test:
A configuration where interval_start_minutes exceeds interval_end_minutes. This should trigger a validation error.
Expected behavior: A ValidationError is raised with the correct error message.
Divisibility Check Test:
A configuration where interval_start_minutes is not divisible by the specified time_resolution_minutes. This should trigger a validation error.
Expected behavior: A ValidationError is raised indicating that the start time must be divisible by the time resolution.
Checklist:
My code follows OCF's coding style guidelines
I have performed a self-review of my own code
I have made corresponding changes to the documentation
I have added tests that prove my fix is effective or that my feature works
I have checked my code and corrected any misspellings