Add support for displaying Daf Yomi (#30628)
* Add support for displaying Daf Yomi * Ran black --fast * Added docstring to get_daf * Further lint fixes * Remove unnecessary else * clarify code * Use fstrings * pull daf yomi from hdate * Update manifest version for daf_yomi support * fix variable usage * Update requirements * Also pass in today's date as well * Rename date variable to daytime_date * Add tests for daf yomi sensor * Update stale test IDs
This commit is contained in:
1 parent
481d3295a6
commit
7dff5e79d1
6 files changed
+47
-10
No files matched your search
@@ -568,3 +568,37 @@ async def test_omer_sensor(hass, test_time, result):
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert hass.states.get("sensor.test_day_of_the_omer").state == result
|
||||
|
||||
|
||||
DAFYOMI_PARAMS = [
|
||||
(dt(2014, 4, 28, 0), "Beitzah 29"),
|
||||
(dt(2020, 1, 4, 0), "Niddah 73"),
|
||||
(dt(2020, 1, 5, 0), "Berachos 2"),
|
||||
(dt(2020, 3, 7, 0), "Berachos 64"),
|
||||
(dt(2020, 3, 8, 0), "Shabbos 2"),
|
||||
]
|
||||
DAFYOMI_TEST_IDS = [
|
||||
"randomly_picked_date",
|
||||
"end_of_cycle13",
|
||||
"start_of_cycle14",
|
||||
"cycle14_end_of_berachos",
|
||||
"cycle14_start_of_shabbos",
|
||||
]
|
||||
|
||||
|
||||
@pytest.mark.parametrize(["test_time", "result"], DAFYOMI_PARAMS, ids=DAFYOMI_TEST_IDS)
|
||||
async def test_dafyomi_sensor(hass, test_time, result):
|
||||
"""Test Daf Yomi sensor output."""
|
||||
test_time = hass.config.time_zone.localize(test_time)
|
||||
|
||||
with alter_time(test_time):
|
||||
assert await async_setup_component(
|
||||
hass, jewish_calendar.DOMAIN, {"jewish_calendar": {"name": "test"}}
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
future = dt_util.utcnow() + timedelta(seconds=30)
|
||||
async_fire_time_changed(hass, future)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert hass.states.get("sensor.test_daf_yomi").state == result
|
||||
Reference in new issue
Block a user