Add SelectorType enum and TypedDicts for each selector's data (#68399)

* rebase off current

* rearrange

* Overload selector function

* Update/fix all selector references

* better typing?

* remove extra option

* move things around

* Switch to Sequence type to avoid ignoring mypy error

* Get rid of ...'s

* Improve typing to reduce number of ignores

* Remove all typing ignores

* Make config optional for selectors that don't need a config

* add missing unit prefixes

* Rename TypedDicts

* Update homeassistant/helpers/selector.py

Co-authored-by: Erik Montnemery <erik@montnemery.com>

* review feedback

* remove peta from integration integration

* Fix min_max

* Revert change to selector function

* Fix logic

* Add typing for selector classes

* Update selector.py

* Fix indent

Co-authored-by: Erik Montnemery <erik@montnemery.com>
This commit is contained in:
Raman Gupta 2022-04-11 03:20:56 -04:00 committed by GitHub
parent e996142592
commit b325c112b4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 525 additions and 239 deletions

View file

@ -266,7 +266,13 @@ def test_addon_selector_schema(schema, valid_selections, invalid_selections):
)
def test_boolean_selector_schema(schema, valid_selections, invalid_selections):
"""Test boolean selector."""
_test_selector("boolean", schema, valid_selections, invalid_selections, bool)
_test_selector(
"boolean",
schema,
valid_selections,
invalid_selections,
bool,
)
@pytest.mark.parametrize(
@ -512,7 +518,13 @@ def test_media_selector_schema(schema, valid_selections, invalid_selections):
data.pop("metadata", None)
return data
_test_selector("media", schema, valid_selections, invalid_selections, drop_metadata)
_test_selector(
"media",
schema,
valid_selections,
invalid_selections,
drop_metadata,
)
@pytest.mark.parametrize(