-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Return history for entities in the order they were requested #25560
Return history for entities in the order they were requested #25560
Conversation
Hey there @home-assistant/core, mind taking a look at this pull request as its been labeled with a integration ( This is a automatic comment generated by codeowners-mention to help ensure issues and pull requests are seen by the right people. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can be merged once the lint issue is resolved!
No. It's not working for |
Do you think you could write a test case or 2 for the conditions if not already covered? |
Fixed. Please take an extra look on that one. I'm not comfortable with writing tests yet... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
Failing test is for Python 3.5, which is to be expected. Edit: For clarification, everything works the same way as it always did with python 3.5 rather than in the new way, so the new test fails. Is there an option to ignore tests for certain python versions? |
@thomasloven you can use @pytest.mark.skipif(sys.version_info < (3, 6), reason="requires python3.6 or higher") |
Thanks. That gave me what I needed to find the unittest equivalent. |
Ignore is no options because it's the current main version. End of the week we remove python3.5 and we don't block this PR after that. |
Good point. Reverting |
Py36 PR #25582 |
@@ -211,6 +212,9 @@ def states_to_json( | |||
axis correctly. | |||
""" | |||
result = defaultdict(list) | |||
if isinstance(entity_ids, Iterable): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not a right check, a string is iterable too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess it works because we don't pass a list. We should just guard against it being None
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
*Gasp! Stack overflow lied to me!
Thanks for fixing.
Will entity_ids
NEVER be a single entity_id in a string?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
based on the code, no.
Description:
Return history data in order
Also see home-assistant/frontend#3436
Related issue (if applicable): fixes home-assistant/ui-schema#213
Pull request with documentation for home-assistant.io (if applicable): N/A
Checklist:
tox
. Your PR cannot be merged unless tests pass