mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 12:59:34 +00:00
Matrix Chatbot (#13355)
* Add first version of the Matrix bot * It's a stupid but necessary change… * Dont list it twice * All hail the linter! * More linter-pleasing * Use the correct user ID * Add expression commands * Add tests for new validators * Fix room alias handling * Wording * Defer setup * Simplify commands * Handle exceptions * Update requirements * Review * Move login back to constructor * Fix review comments
This commit is contained in:
committed by
Paulus Schoutsen
parent
95d27bd1fa
commit
af8cd63838
@@ -565,3 +565,31 @@ def test_socket_timeout(): # pylint: disable=invalid-name
|
||||
assert _GLOBAL_DEFAULT_TIMEOUT == schema(None)
|
||||
|
||||
assert schema(1) == 1.0
|
||||
|
||||
|
||||
def test_matches_regex():
|
||||
"""Test matches_regex validator."""
|
||||
schema = vol.Schema(cv.matches_regex('.*uiae.*'))
|
||||
|
||||
with pytest.raises(vol.Invalid):
|
||||
schema(1.0)
|
||||
|
||||
with pytest.raises(vol.Invalid):
|
||||
schema(" nrtd ")
|
||||
|
||||
test_str = "This is a test including uiae."
|
||||
assert(schema(test_str) == test_str)
|
||||
|
||||
|
||||
def test_is_regex():
|
||||
"""Test the is_regex validator."""
|
||||
schema = vol.Schema(cv.is_regex)
|
||||
|
||||
with pytest.raises(vol.Invalid):
|
||||
schema("(")
|
||||
|
||||
with pytest.raises(vol.Invalid):
|
||||
schema({"a dict": "is not a regex"})
|
||||
|
||||
valid_re = ".*"
|
||||
schema(valid_re)
|
||||
|
||||
Reference in New Issue
Block a user