mirror of
https://github.com/elisspace/core.git
synced 2026-09-29 05:49:53 +00:00
rewrite hangouts to use intents instead of commands (#16220)
* rewrite hangouts to use intents instead of commands * small fixes * remove configured_hangouts check and CONFIG_SCHEMA * Lint * add import from .config_flow
This commit is contained in:
committed by
Paulus Schoutsen
parent
2744702f9b
commit
a953601abd
@@ -290,11 +290,11 @@ async def test_http_api_wrong_data(hass, aiohttp_client):
|
||||
def test_create_matcher():
|
||||
"""Test the create matcher method."""
|
||||
# Basic sentence
|
||||
pattern = conversation._create_matcher('Hello world')
|
||||
pattern = conversation.create_matcher('Hello world')
|
||||
assert pattern.match('Hello world') is not None
|
||||
|
||||
# Match a part
|
||||
pattern = conversation._create_matcher('Hello {name}')
|
||||
pattern = conversation.create_matcher('Hello {name}')
|
||||
match = pattern.match('hello world')
|
||||
assert match is not None
|
||||
assert match.groupdict()['name'] == 'world'
|
||||
@@ -302,7 +302,7 @@ def test_create_matcher():
|
||||
assert no_match is None
|
||||
|
||||
# Optional and matching part
|
||||
pattern = conversation._create_matcher('Turn on [the] {name}')
|
||||
pattern = conversation.create_matcher('Turn on [the] {name}')
|
||||
match = pattern.match('turn on the kitchen lights')
|
||||
assert match is not None
|
||||
assert match.groupdict()['name'] == 'kitchen lights'
|
||||
@@ -313,7 +313,7 @@ def test_create_matcher():
|
||||
assert match is None
|
||||
|
||||
# Two different optional parts, 1 matching part
|
||||
pattern = conversation._create_matcher('Turn on [the] [a] {name}')
|
||||
pattern = conversation.create_matcher('Turn on [the] [a] {name}')
|
||||
match = pattern.match('turn on the kitchen lights')
|
||||
assert match is not None
|
||||
assert match.groupdict()['name'] == 'kitchen lights'
|
||||
@@ -325,13 +325,13 @@ def test_create_matcher():
|
||||
assert match.groupdict()['name'] == 'kitchen light'
|
||||
|
||||
# Strip plural
|
||||
pattern = conversation._create_matcher('Turn {name}[s] on')
|
||||
pattern = conversation.create_matcher('Turn {name}[s] on')
|
||||
match = pattern.match('turn kitchen lights on')
|
||||
assert match is not None
|
||||
assert match.groupdict()['name'] == 'kitchen light'
|
||||
|
||||
# Optional 2 words
|
||||
pattern = conversation._create_matcher('Turn [the great] {name} on')
|
||||
pattern = conversation.create_matcher('Turn [the great] {name} on')
|
||||
match = pattern.match('turn the great kitchen lights on')
|
||||
assert match is not None
|
||||
assert match.groupdict()['name'] == 'kitchen lights'
|
||||
|
||||
Reference in New Issue
Block a user