bito-code-review[bot] commented on PR #42269:
URL: https://github.com/apache/superset/pull/42269#issuecomment-5034327515
<!-- Bito Reply -->
The flagged issue is correct. The current test
`test_relative_offset_preserves_inner_bounds` only performs local variable
assignments and assertions, failing to exercise the actual
`processing_time_offsets` logic in `superset/models/helpers.py` where the fix
was applied. To resolve this, the test should instantiate a `QueryObject` and
invoke the `processing_time_offsets` function to verify that the
`inner_from_dttm` and `inner_to_dttm` attributes are correctly set on the
resulting object.
Here is a concise implementation of the corrected test:
```python
def test_relative_offset_preserves_inner_bounds():
from superset.models.helpers import processing_time_offsets
from superset.common.query_object import QueryObject
query_object = QueryObject(from_dttm="2026-05-01", to_dttm="2026-05-28")
# Mock or provide necessary context for processing_time_offsets
# ... setup query_object_clone ...
processing_time_offsets(query_object, query_object_clone, "365 days ago")
assert query_object_clone.inner_from_dttm == datetime(2026, 5, 1)
assert query_object_clone.inner_to_dttm == datetime(2026, 5, 28)
```
I have checked the PR comments and there are no other comments to address.
Would you like me to look for any other potential improvements in this PR?
**tests/unit_tests/common/test_query_context_processor.py**
```
def test_relative_offset_preserves_inner_bounds():
from superset.models.helpers import processing_time_offsets
from superset.common.query_object import QueryObject
query_object = QueryObject(from_dttm="2026-05-01", to_dttm="2026-05-28")
# Mock or provide necessary context for processing_time_offsets
# ... setup query_object_clone ...
processing_time_offsets(query_object, query_object_clone, "365 days ago")
assert query_object_clone.inner_from_dttm == datetime(2026, 5, 1)
assert query_object_clone.inner_to_dttm == datetime(2026, 5, 28)
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]