Optimize event matcher (#9798)
* Optimize event matcher * Tweak order of checks * Add a benchmark for time_changed helper * Add state change benchmark * fix lint
This commit is contained in:
1 parent
a97e7bb22d
commit
8f06b35dfc
3 files changed
+104
-43
No files matched your search
@@ -5,6 +5,7 @@ import unittest
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
from astral import Astral
|
||||
import pytest
|
||||
|
||||
from homeassistant.setup import setup_component
|
||||
import homeassistant.core as ha
|
||||
@@ -634,8 +635,9 @@ class TestEventHelpers(unittest.TestCase):
|
||||
"""Test periodic tasks with wrong input."""
|
||||
specific_runs = []
|
||||
|
||||
track_utc_time_change(
|
||||
self.hass, lambda x: specific_runs.append(1), year='/two')
|
||||
with pytest.raises(ValueError):
|
||||
track_utc_time_change(
|
||||
self.hass, lambda x: specific_runs.append(1), year='/two')
|
||||
|
||||
self._send_time_changed(datetime(2014, 5, 2, 0, 0, 0))
|
||||
self.hass.block_till_done()
|
||||
|
||||
Reference in new issue
Block a user