mirror of
https://github.com/home-assistant/core.git
synced 2025-07-18 18:57:06 +00:00
Bump hdate to 1.1.0 (#143759)
This commit is contained in:
parent
d7f5e48626
commit
84f07ee992
@ -131,7 +131,7 @@ async def async_migrate_entry(
|
||||
return {"new_unique_id": new_unique_id}
|
||||
return None
|
||||
|
||||
if config_entry.version > 1:
|
||||
if config_entry.version > 2:
|
||||
# This means the user has downgraded from a future version
|
||||
return False
|
||||
|
||||
@ -139,4 +139,9 @@ async def async_migrate_entry(
|
||||
await er.async_migrate_entries(hass, config_entry.entry_id, update_unique_id)
|
||||
hass.config_entries.async_update_entry(config_entry, version=2)
|
||||
|
||||
if config_entry.version == 2:
|
||||
new_data = {**config_entry.data}
|
||||
new_data[CONF_LANGUAGE] = config_entry.data[CONF_LANGUAGE][:2]
|
||||
hass.config_entries.async_update_entry(config_entry, data=new_data, version=3)
|
||||
|
||||
return True
|
||||
|
@ -91,7 +91,6 @@ class JewishCalendarBinarySensor(JewishCalendarEntity, BinarySensorEntity):
|
||||
location=self._location,
|
||||
candle_lighting_offset=self._candle_lighting_offset,
|
||||
havdalah_offset=self._havdalah_offset,
|
||||
language=self._language,
|
||||
)
|
||||
|
||||
async def async_added_to_hass(self) -> None:
|
||||
|
@ -3,9 +3,10 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
from typing import Any
|
||||
from typing import Any, get_args
|
||||
import zoneinfo
|
||||
|
||||
from hdate.translator import Language
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.config_entries import (
|
||||
@ -25,8 +26,9 @@ from homeassistant.const import (
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.helpers.selector import (
|
||||
BooleanSelector,
|
||||
LanguageSelector,
|
||||
LanguageSelectorConfig,
|
||||
LocationSelector,
|
||||
SelectOptionDict,
|
||||
SelectSelector,
|
||||
SelectSelectorConfig,
|
||||
)
|
||||
@ -43,11 +45,6 @@ from .const import (
|
||||
DOMAIN,
|
||||
)
|
||||
|
||||
LANGUAGE = [
|
||||
SelectOptionDict(value="hebrew", label="Hebrew"),
|
||||
SelectOptionDict(value="english", label="English"),
|
||||
]
|
||||
|
||||
OPTIONS_SCHEMA = vol.Schema(
|
||||
{
|
||||
vol.Optional(CONF_CANDLE_LIGHT_MINUTES, default=DEFAULT_CANDLE_LIGHT): int,
|
||||
@ -72,8 +69,8 @@ async def _get_data_schema(hass: HomeAssistant) -> vol.Schema:
|
||||
return vol.Schema(
|
||||
{
|
||||
vol.Required(CONF_DIASPORA, default=DEFAULT_DIASPORA): BooleanSelector(),
|
||||
vol.Required(CONF_LANGUAGE, default=DEFAULT_LANGUAGE): SelectSelector(
|
||||
SelectSelectorConfig(options=LANGUAGE)
|
||||
vol.Required(CONF_LANGUAGE, default=DEFAULT_LANGUAGE): LanguageSelector(
|
||||
LanguageSelectorConfig(languages=list(get_args(Language)))
|
||||
),
|
||||
vol.Optional(CONF_LOCATION, default=default_location): LocationSelector(),
|
||||
vol.Optional(CONF_ELEVATION, default=hass.config.elevation): int,
|
||||
@ -87,7 +84,7 @@ async def _get_data_schema(hass: HomeAssistant) -> vol.Schema:
|
||||
class JewishCalendarConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||
"""Handle a config flow for Jewish calendar."""
|
||||
|
||||
VERSION = 2
|
||||
VERSION = 3
|
||||
|
||||
@staticmethod
|
||||
@callback
|
||||
|
@ -13,6 +13,6 @@ DEFAULT_NAME = "Jewish Calendar"
|
||||
DEFAULT_CANDLE_LIGHT = 18
|
||||
DEFAULT_DIASPORA = False
|
||||
DEFAULT_HAVDALAH_OFFSET_MINUTES = 0
|
||||
DEFAULT_LANGUAGE = "english"
|
||||
DEFAULT_LANGUAGE = "en"
|
||||
|
||||
SERVICE_COUNT_OMER = "count_omer"
|
||||
|
@ -3,7 +3,7 @@
|
||||
from dataclasses import dataclass
|
||||
|
||||
from hdate import Location
|
||||
from hdate.translator import Language
|
||||
from hdate.translator import Language, set_language
|
||||
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.helpers.device_registry import DeviceEntryType, DeviceInfo
|
||||
@ -44,7 +44,7 @@ class JewishCalendarEntity(Entity):
|
||||
)
|
||||
data = config_entry.runtime_data
|
||||
self._location = data.location
|
||||
self._language = data.language
|
||||
self._candle_lighting_offset = data.candle_lighting_offset
|
||||
self._havdalah_offset = data.havdalah_offset
|
||||
self._diaspora = data.diaspora
|
||||
set_language(data.language)
|
||||
|
@ -6,6 +6,6 @@
|
||||
"documentation": "https://www.home-assistant.io/integrations/jewish_calendar",
|
||||
"iot_class": "calculated",
|
||||
"loggers": ["hdate"],
|
||||
"requirements": ["hdate[astral]==1.0.3"],
|
||||
"requirements": ["hdate[astral]==1.1.0"],
|
||||
"single_config_entry": true
|
||||
}
|
||||
|
@ -218,9 +218,7 @@ class JewishCalendarSensor(JewishCalendarEntity, SensorEntity):
|
||||
|
||||
_LOGGER.debug("Now: %s Sunset: %s", now, sunset)
|
||||
|
||||
daytime_date = HDateInfo(
|
||||
today, diaspora=self._diaspora, language=self._language
|
||||
)
|
||||
daytime_date = HDateInfo(today, diaspora=self._diaspora)
|
||||
|
||||
# The Jewish day starts after darkness (called "tzais") and finishes at
|
||||
# sunset ("shkia"). The time in between is a gray area
|
||||
@ -253,7 +251,6 @@ class JewishCalendarSensor(JewishCalendarEntity, SensorEntity):
|
||||
location=self._location,
|
||||
candle_lighting_offset=self._candle_lighting_offset,
|
||||
havdalah_offset=self._havdalah_offset,
|
||||
language=self._language,
|
||||
)
|
||||
|
||||
@property
|
||||
@ -272,7 +269,6 @@ class JewishCalendarSensor(JewishCalendarEntity, SensorEntity):
|
||||
# refers to "current" or "upcoming" dates.
|
||||
if self.entity_description.key == "date":
|
||||
hdate = after_shkia_date.hdate
|
||||
hdate.month.set_language(self._language)
|
||||
self._attrs = {
|
||||
"hebrew_year": str(hdate.year),
|
||||
"hebrew_month_name": str(hdate.month),
|
||||
@ -290,9 +286,7 @@ class JewishCalendarSensor(JewishCalendarEntity, SensorEntity):
|
||||
dict.fromkeys(_holiday.type.name for _holiday in _holidays)
|
||||
)
|
||||
self._attrs = {"id": _id, "type": _type}
|
||||
self._attr_options = HolidayDatabase(self._diaspora).get_all_names(
|
||||
self._language
|
||||
)
|
||||
self._attr_options = HolidayDatabase(self._diaspora).get_all_names()
|
||||
return ", ".join(str(holiday) for holiday in _holidays) if _holidays else ""
|
||||
if self.entity_description.key == "omer_count":
|
||||
return after_shkia_date.omer.total_days if after_shkia_date.omer else 0
|
||||
|
@ -1,11 +1,11 @@
|
||||
"""Services for Jewish Calendar."""
|
||||
|
||||
import datetime
|
||||
from typing import cast
|
||||
from typing import get_args
|
||||
|
||||
from hdate import HebrewDate
|
||||
from hdate.omer import Nusach, Omer
|
||||
from hdate.translator import Language
|
||||
from hdate.translator import Language, set_language
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.const import CONF_LANGUAGE
|
||||
@ -20,7 +20,6 @@ from homeassistant.helpers.selector import LanguageSelector, LanguageSelectorCon
|
||||
|
||||
from .const import ATTR_DATE, ATTR_NUSACH, DOMAIN, SERVICE_COUNT_OMER
|
||||
|
||||
SUPPORTED_LANGUAGES = {"en": "english", "fr": "french", "he": "hebrew"}
|
||||
OMER_SCHEMA = vol.Schema(
|
||||
{
|
||||
vol.Required(ATTR_DATE, default=datetime.date.today): cv.date,
|
||||
@ -28,7 +27,7 @@ OMER_SCHEMA = vol.Schema(
|
||||
[nusach.name.lower() for nusach in Nusach]
|
||||
),
|
||||
vol.Required(CONF_LANGUAGE, default="he"): LanguageSelector(
|
||||
LanguageSelectorConfig(languages=list(SUPPORTED_LANGUAGES.keys()))
|
||||
LanguageSelectorConfig(languages=list(get_args(Language)))
|
||||
),
|
||||
}
|
||||
)
|
||||
@ -41,12 +40,8 @@ def async_setup_services(hass: HomeAssistant) -> None:
|
||||
"""Return the Omer blessing for a given date."""
|
||||
hebrew_date = HebrewDate.from_gdate(call.data["date"])
|
||||
nusach = Nusach[call.data["nusach"].upper()]
|
||||
|
||||
# Currently Omer only supports Hebrew, English, and French and requires
|
||||
# the full language name
|
||||
language = cast(Language, SUPPORTED_LANGUAGES[call.data[CONF_LANGUAGE]])
|
||||
|
||||
omer = Omer(date=hebrew_date, nusach=nusach, language=language)
|
||||
set_language(call.data[CONF_LANGUAGE])
|
||||
omer = Omer(date=hebrew_date, nusach=nusach)
|
||||
return {
|
||||
"message": str(omer.count_str()),
|
||||
"weeks": omer.week,
|
||||
|
2
requirements_all.txt
generated
2
requirements_all.txt
generated
@ -1130,7 +1130,7 @@ hass-splunk==0.1.1
|
||||
hassil==2.2.3
|
||||
|
||||
# homeassistant.components.jewish_calendar
|
||||
hdate[astral]==1.0.3
|
||||
hdate[astral]==1.1.0
|
||||
|
||||
# homeassistant.components.heatmiser
|
||||
heatmiserV3==2.0.3
|
||||
|
2
requirements_test_all.txt
generated
2
requirements_test_all.txt
generated
@ -969,7 +969,7 @@ hass-nabucasa==0.96.0
|
||||
hassil==2.2.3
|
||||
|
||||
# homeassistant.components.jewish_calendar
|
||||
hdate[astral]==1.0.3
|
||||
hdate[astral]==1.1.0
|
||||
|
||||
# homeassistant.components.here_travel_time
|
||||
here-routing==1.0.1
|
||||
|
@ -6,6 +6,7 @@ from typing import NamedTuple
|
||||
from unittest.mock import AsyncMock, patch
|
||||
|
||||
from freezegun import freeze_time
|
||||
from hdate.translator import set_language
|
||||
import pytest
|
||||
|
||||
from homeassistant.components.jewish_calendar.const import (
|
||||
@ -74,18 +75,29 @@ def _test_time(
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def results(request: pytest.FixtureRequest, tz_info: dt.tzinfo) -> Iterable:
|
||||
def results(
|
||||
request: pytest.FixtureRequest, tz_info: dt.tzinfo, language: str
|
||||
) -> Iterable:
|
||||
"""Return localized results."""
|
||||
if not hasattr(request, "param"):
|
||||
return None
|
||||
|
||||
# If results are generated, by using the HDate library, we need to set the language
|
||||
set_language(language)
|
||||
|
||||
if isinstance(request.param, dict):
|
||||
return {
|
||||
result = {
|
||||
key: value.replace(tzinfo=tz_info)
|
||||
if isinstance(value, dt.datetime)
|
||||
else value
|
||||
for key, value in request.param.items()
|
||||
}
|
||||
if "attr" in result and isinstance(result["attr"], dict):
|
||||
result["attr"] = {
|
||||
key: value() if callable(value) else value
|
||||
for key, value in result["attr"].items()
|
||||
}
|
||||
return result
|
||||
return request.param
|
||||
|
||||
|
||||
@ -98,7 +110,7 @@ def havdalah_offset() -> int | None:
|
||||
@pytest.fixture
|
||||
def language() -> str:
|
||||
"""Return default language value, unless language is parametrized."""
|
||||
return "english"
|
||||
return "en"
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
|
@ -17,7 +17,7 @@ from homeassistant.util import dt as dt_util
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
|
||||
@pytest.mark.parametrize("language", ["english", "hebrew"])
|
||||
@pytest.mark.parametrize("language", ["en", "he"])
|
||||
async def test_min_config(hass: HomeAssistant, config_entry: MockConfigEntry) -> None:
|
||||
"""Test minimum jewish calendar configuration."""
|
||||
config_entry.add_to_hass(hass)
|
||||
@ -31,7 +31,7 @@ TEST_PARAMS = [
|
||||
"Jerusalem",
|
||||
dt(2018, 9, 3),
|
||||
{"state": "23 Elul 5778"},
|
||||
"english",
|
||||
"en",
|
||||
"date",
|
||||
id="date_output",
|
||||
),
|
||||
@ -39,7 +39,7 @@ TEST_PARAMS = [
|
||||
"Jerusalem",
|
||||
dt(2018, 9, 3),
|
||||
{"state": 'כ"ג אלול ה\' תשע"ח'},
|
||||
"hebrew",
|
||||
"he",
|
||||
"date",
|
||||
id="date_output_hebrew",
|
||||
),
|
||||
@ -47,7 +47,7 @@ TEST_PARAMS = [
|
||||
"Jerusalem",
|
||||
dt(2018, 9, 10),
|
||||
{"state": "א' ראש השנה"},
|
||||
"hebrew",
|
||||
"he",
|
||||
"holiday",
|
||||
id="holiday",
|
||||
),
|
||||
@ -62,10 +62,10 @@ TEST_PARAMS = [
|
||||
"icon": "mdi:calendar-star",
|
||||
"id": "rosh_hashana_i",
|
||||
"type": "YOM_TOV",
|
||||
"options": HolidayDatabase(False).get_all_names("english"),
|
||||
"options": lambda: HolidayDatabase(False).get_all_names(),
|
||||
},
|
||||
},
|
||||
"english",
|
||||
"en",
|
||||
"holiday",
|
||||
id="holiday_english",
|
||||
),
|
||||
@ -80,10 +80,10 @@ TEST_PARAMS = [
|
||||
"icon": "mdi:calendar-star",
|
||||
"id": "chanukah, rosh_chodesh",
|
||||
"type": "MELACHA_PERMITTED_HOLIDAY, ROSH_CHODESH",
|
||||
"options": HolidayDatabase(False).get_all_names("english"),
|
||||
"options": lambda: HolidayDatabase(False).get_all_names(),
|
||||
},
|
||||
},
|
||||
"english",
|
||||
"en",
|
||||
"holiday",
|
||||
id="holiday_multiple",
|
||||
),
|
||||
@ -99,7 +99,7 @@ TEST_PARAMS = [
|
||||
"options": list(Parasha),
|
||||
},
|
||||
},
|
||||
"hebrew",
|
||||
"he",
|
||||
"parshat_hashavua",
|
||||
id="torah_reading",
|
||||
),
|
||||
@ -107,7 +107,7 @@ TEST_PARAMS = [
|
||||
"New York",
|
||||
dt(2018, 9, 8),
|
||||
{"state": dt(2018, 9, 8, 19, 47)},
|
||||
"hebrew",
|
||||
"he",
|
||||
"t_set_hakochavim",
|
||||
id="first_stars_ny",
|
||||
),
|
||||
@ -115,7 +115,7 @@ TEST_PARAMS = [
|
||||
"Jerusalem",
|
||||
dt(2018, 9, 8),
|
||||
{"state": dt(2018, 9, 8, 19, 21)},
|
||||
"hebrew",
|
||||
"he",
|
||||
"t_set_hakochavim",
|
||||
id="first_stars_jerusalem",
|
||||
),
|
||||
@ -123,7 +123,7 @@ TEST_PARAMS = [
|
||||
"Jerusalem",
|
||||
dt(2018, 10, 14),
|
||||
{"state": "לך לך"},
|
||||
"hebrew",
|
||||
"he",
|
||||
"parshat_hashavua",
|
||||
id="torah_reading_weekday",
|
||||
),
|
||||
@ -131,7 +131,7 @@ TEST_PARAMS = [
|
||||
"Jerusalem",
|
||||
dt(2018, 10, 14, 17, 0, 0),
|
||||
{"state": "ה' מרחשוון ה' תשע\"ט"},
|
||||
"hebrew",
|
||||
"he",
|
||||
"date",
|
||||
id="date_before_sunset",
|
||||
),
|
||||
@ -148,7 +148,7 @@ TEST_PARAMS = [
|
||||
"friendly_name": "Jewish Calendar Date",
|
||||
},
|
||||
},
|
||||
"hebrew",
|
||||
"he",
|
||||
"date",
|
||||
id="date_after_sunset",
|
||||
),
|
||||
@ -181,12 +181,12 @@ SHABBAT_PARAMS = [
|
||||
"New York",
|
||||
dt(2018, 9, 1, 16, 0),
|
||||
{
|
||||
"english_upcoming_candle_lighting": dt(2018, 8, 31, 19, 12),
|
||||
"english_upcoming_havdalah": dt(2018, 9, 1, 20, 10),
|
||||
"english_upcoming_shabbat_candle_lighting": dt(2018, 8, 31, 19, 12),
|
||||
"english_upcoming_shabbat_havdalah": dt(2018, 9, 1, 20, 10),
|
||||
"english_parshat_hashavua": "Ki Tavo",
|
||||
"hebrew_parshat_hashavua": "כי תבוא",
|
||||
"en_upcoming_candle_lighting": dt(2018, 8, 31, 19, 12),
|
||||
"en_upcoming_havdalah": dt(2018, 9, 1, 20, 10),
|
||||
"en_upcoming_shabbat_candle_lighting": dt(2018, 8, 31, 19, 12),
|
||||
"en_upcoming_shabbat_havdalah": dt(2018, 9, 1, 20, 10),
|
||||
"en_parshat_hashavua": "Ki Tavo",
|
||||
"he_parshat_hashavua": "כי תבוא",
|
||||
},
|
||||
None,
|
||||
id="currently_first_shabbat",
|
||||
@ -195,12 +195,12 @@ SHABBAT_PARAMS = [
|
||||
"New York",
|
||||
dt(2018, 9, 1, 16, 0),
|
||||
{
|
||||
"english_upcoming_candle_lighting": dt(2018, 8, 31, 19, 12),
|
||||
"english_upcoming_havdalah": dt(2018, 9, 1, 20, 18),
|
||||
"english_upcoming_shabbat_candle_lighting": dt(2018, 8, 31, 19, 12),
|
||||
"english_upcoming_shabbat_havdalah": dt(2018, 9, 1, 20, 18),
|
||||
"english_parshat_hashavua": "Ki Tavo",
|
||||
"hebrew_parshat_hashavua": "כי תבוא",
|
||||
"en_upcoming_candle_lighting": dt(2018, 8, 31, 19, 12),
|
||||
"en_upcoming_havdalah": dt(2018, 9, 1, 20, 18),
|
||||
"en_upcoming_shabbat_candle_lighting": dt(2018, 8, 31, 19, 12),
|
||||
"en_upcoming_shabbat_havdalah": dt(2018, 9, 1, 20, 18),
|
||||
"en_parshat_hashavua": "Ki Tavo",
|
||||
"he_parshat_hashavua": "כי תבוא",
|
||||
},
|
||||
50, # Havdalah offset
|
||||
id="currently_first_shabbat_with_havdalah_offset",
|
||||
@ -209,12 +209,12 @@ SHABBAT_PARAMS = [
|
||||
"New York",
|
||||
dt(2018, 9, 1, 20, 0),
|
||||
{
|
||||
"english_upcoming_shabbat_candle_lighting": dt(2018, 8, 31, 19, 12),
|
||||
"english_upcoming_shabbat_havdalah": dt(2018, 9, 1, 20, 10),
|
||||
"english_upcoming_candle_lighting": dt(2018, 8, 31, 19, 12),
|
||||
"english_upcoming_havdalah": dt(2018, 9, 1, 20, 10),
|
||||
"english_parshat_hashavua": "Ki Tavo",
|
||||
"hebrew_parshat_hashavua": "כי תבוא",
|
||||
"en_upcoming_shabbat_candle_lighting": dt(2018, 8, 31, 19, 12),
|
||||
"en_upcoming_shabbat_havdalah": dt(2018, 9, 1, 20, 10),
|
||||
"en_upcoming_candle_lighting": dt(2018, 8, 31, 19, 12),
|
||||
"en_upcoming_havdalah": dt(2018, 9, 1, 20, 10),
|
||||
"en_parshat_hashavua": "Ki Tavo",
|
||||
"he_parshat_hashavua": "כי תבוא",
|
||||
},
|
||||
None,
|
||||
id="currently_first_shabbat_bein_hashmashot_lagging_date",
|
||||
@ -223,12 +223,12 @@ SHABBAT_PARAMS = [
|
||||
"New York",
|
||||
dt(2018, 9, 1, 20, 21),
|
||||
{
|
||||
"english_upcoming_candle_lighting": dt(2018, 9, 7, 19),
|
||||
"english_upcoming_havdalah": dt(2018, 9, 8, 19, 58),
|
||||
"english_upcoming_shabbat_candle_lighting": dt(2018, 9, 7, 19),
|
||||
"english_upcoming_shabbat_havdalah": dt(2018, 9, 8, 19, 58),
|
||||
"english_parshat_hashavua": "Nitzavim",
|
||||
"hebrew_parshat_hashavua": "נצבים",
|
||||
"en_upcoming_candle_lighting": dt(2018, 9, 7, 19),
|
||||
"en_upcoming_havdalah": dt(2018, 9, 8, 19, 58),
|
||||
"en_upcoming_shabbat_candle_lighting": dt(2018, 9, 7, 19),
|
||||
"en_upcoming_shabbat_havdalah": dt(2018, 9, 8, 19, 58),
|
||||
"en_parshat_hashavua": "Nitzavim",
|
||||
"he_parshat_hashavua": "נצבים",
|
||||
},
|
||||
None,
|
||||
id="after_first_shabbat",
|
||||
@ -237,12 +237,12 @@ SHABBAT_PARAMS = [
|
||||
"New York",
|
||||
dt(2018, 9, 7, 13, 1),
|
||||
{
|
||||
"english_upcoming_candle_lighting": dt(2018, 9, 7, 19),
|
||||
"english_upcoming_havdalah": dt(2018, 9, 8, 19, 58),
|
||||
"english_upcoming_shabbat_candle_lighting": dt(2018, 9, 7, 19),
|
||||
"english_upcoming_shabbat_havdalah": dt(2018, 9, 8, 19, 58),
|
||||
"english_parshat_hashavua": "Nitzavim",
|
||||
"hebrew_parshat_hashavua": "נצבים",
|
||||
"en_upcoming_candle_lighting": dt(2018, 9, 7, 19),
|
||||
"en_upcoming_havdalah": dt(2018, 9, 8, 19, 58),
|
||||
"en_upcoming_shabbat_candle_lighting": dt(2018, 9, 7, 19),
|
||||
"en_upcoming_shabbat_havdalah": dt(2018, 9, 8, 19, 58),
|
||||
"en_parshat_hashavua": "Nitzavim",
|
||||
"he_parshat_hashavua": "נצבים",
|
||||
},
|
||||
None,
|
||||
id="friday_upcoming_shabbat",
|
||||
@ -251,14 +251,14 @@ SHABBAT_PARAMS = [
|
||||
"New York",
|
||||
dt(2018, 9, 8, 21, 25),
|
||||
{
|
||||
"english_upcoming_candle_lighting": dt(2018, 9, 9, 18, 57),
|
||||
"english_upcoming_havdalah": dt(2018, 9, 11, 19, 53),
|
||||
"english_upcoming_shabbat_candle_lighting": dt(2018, 9, 14, 18, 48),
|
||||
"english_upcoming_shabbat_havdalah": dt(2018, 9, 15, 19, 46),
|
||||
"english_parshat_hashavua": "Vayeilech",
|
||||
"hebrew_parshat_hashavua": "וילך",
|
||||
"english_holiday": "Erev Rosh Hashana",
|
||||
"hebrew_holiday": "ערב ראש השנה",
|
||||
"en_upcoming_candle_lighting": dt(2018, 9, 9, 18, 57),
|
||||
"en_upcoming_havdalah": dt(2018, 9, 11, 19, 53),
|
||||
"en_upcoming_shabbat_candle_lighting": dt(2018, 9, 14, 18, 48),
|
||||
"en_upcoming_shabbat_havdalah": dt(2018, 9, 15, 19, 46),
|
||||
"en_parshat_hashavua": "Vayeilech",
|
||||
"he_parshat_hashavua": "וילך",
|
||||
"en_holiday": "Erev Rosh Hashana",
|
||||
"he_holiday": "ערב ראש השנה",
|
||||
},
|
||||
None,
|
||||
id="upcoming_rosh_hashana",
|
||||
@ -267,14 +267,14 @@ SHABBAT_PARAMS = [
|
||||
"New York",
|
||||
dt(2018, 9, 9, 21, 25),
|
||||
{
|
||||
"english_upcoming_candle_lighting": dt(2018, 9, 9, 18, 57),
|
||||
"english_upcoming_havdalah": dt(2018, 9, 11, 19, 53),
|
||||
"english_upcoming_shabbat_candle_lighting": dt(2018, 9, 14, 18, 48),
|
||||
"english_upcoming_shabbat_havdalah": dt(2018, 9, 15, 19, 46),
|
||||
"english_parshat_hashavua": "Vayeilech",
|
||||
"hebrew_parshat_hashavua": "וילך",
|
||||
"english_holiday": "Rosh Hashana I",
|
||||
"hebrew_holiday": "א' ראש השנה",
|
||||
"en_upcoming_candle_lighting": dt(2018, 9, 9, 18, 57),
|
||||
"en_upcoming_havdalah": dt(2018, 9, 11, 19, 53),
|
||||
"en_upcoming_shabbat_candle_lighting": dt(2018, 9, 14, 18, 48),
|
||||
"en_upcoming_shabbat_havdalah": dt(2018, 9, 15, 19, 46),
|
||||
"en_parshat_hashavua": "Vayeilech",
|
||||
"he_parshat_hashavua": "וילך",
|
||||
"en_holiday": "Rosh Hashana I",
|
||||
"he_holiday": "א' ראש השנה",
|
||||
},
|
||||
None,
|
||||
id="currently_rosh_hashana",
|
||||
@ -283,14 +283,14 @@ SHABBAT_PARAMS = [
|
||||
"New York",
|
||||
dt(2018, 9, 10, 21, 25),
|
||||
{
|
||||
"english_upcoming_candle_lighting": dt(2018, 9, 9, 18, 57),
|
||||
"english_upcoming_havdalah": dt(2018, 9, 11, 19, 53),
|
||||
"english_upcoming_shabbat_candle_lighting": dt(2018, 9, 14, 18, 48),
|
||||
"english_upcoming_shabbat_havdalah": dt(2018, 9, 15, 19, 46),
|
||||
"english_parshat_hashavua": "Vayeilech",
|
||||
"hebrew_parshat_hashavua": "וילך",
|
||||
"english_holiday": "Rosh Hashana II",
|
||||
"hebrew_holiday": "ב' ראש השנה",
|
||||
"en_upcoming_candle_lighting": dt(2018, 9, 9, 18, 57),
|
||||
"en_upcoming_havdalah": dt(2018, 9, 11, 19, 53),
|
||||
"en_upcoming_shabbat_candle_lighting": dt(2018, 9, 14, 18, 48),
|
||||
"en_upcoming_shabbat_havdalah": dt(2018, 9, 15, 19, 46),
|
||||
"en_parshat_hashavua": "Vayeilech",
|
||||
"he_parshat_hashavua": "וילך",
|
||||
"en_holiday": "Rosh Hashana II",
|
||||
"he_holiday": "ב' ראש השנה",
|
||||
},
|
||||
None,
|
||||
id="second_day_rosh_hashana",
|
||||
@ -299,12 +299,12 @@ SHABBAT_PARAMS = [
|
||||
"New York",
|
||||
dt(2018, 9, 28, 21, 25),
|
||||
{
|
||||
"english_upcoming_candle_lighting": dt(2018, 9, 28, 18, 25),
|
||||
"english_upcoming_havdalah": dt(2018, 9, 29, 19, 22),
|
||||
"english_upcoming_shabbat_candle_lighting": dt(2018, 9, 28, 18, 25),
|
||||
"english_upcoming_shabbat_havdalah": dt(2018, 9, 29, 19, 22),
|
||||
"english_parshat_hashavua": "none",
|
||||
"hebrew_parshat_hashavua": "none",
|
||||
"en_upcoming_candle_lighting": dt(2018, 9, 28, 18, 25),
|
||||
"en_upcoming_havdalah": dt(2018, 9, 29, 19, 22),
|
||||
"en_upcoming_shabbat_candle_lighting": dt(2018, 9, 28, 18, 25),
|
||||
"en_upcoming_shabbat_havdalah": dt(2018, 9, 29, 19, 22),
|
||||
"en_parshat_hashavua": "none",
|
||||
"he_parshat_hashavua": "none",
|
||||
},
|
||||
None,
|
||||
id="currently_shabbat_chol_hamoed",
|
||||
@ -313,14 +313,14 @@ SHABBAT_PARAMS = [
|
||||
"New York",
|
||||
dt(2018, 9, 29, 21, 25),
|
||||
{
|
||||
"english_upcoming_candle_lighting": dt(2018, 9, 30, 18, 22),
|
||||
"english_upcoming_havdalah": dt(2018, 10, 2, 19, 17),
|
||||
"english_upcoming_shabbat_candle_lighting": dt(2018, 10, 5, 18, 13),
|
||||
"english_upcoming_shabbat_havdalah": dt(2018, 10, 6, 19, 11),
|
||||
"english_parshat_hashavua": "Bereshit",
|
||||
"hebrew_parshat_hashavua": "בראשית",
|
||||
"english_holiday": "Hoshana Raba",
|
||||
"hebrew_holiday": "הושענא רבה",
|
||||
"en_upcoming_candle_lighting": dt(2018, 9, 30, 18, 22),
|
||||
"en_upcoming_havdalah": dt(2018, 10, 2, 19, 17),
|
||||
"en_upcoming_shabbat_candle_lighting": dt(2018, 10, 5, 18, 13),
|
||||
"en_upcoming_shabbat_havdalah": dt(2018, 10, 6, 19, 11),
|
||||
"en_parshat_hashavua": "Bereshit",
|
||||
"he_parshat_hashavua": "בראשית",
|
||||
"en_holiday": "Hoshana Raba",
|
||||
"he_holiday": "הושענא רבה",
|
||||
},
|
||||
None,
|
||||
id="upcoming_two_day_yomtov_in_diaspora",
|
||||
@ -329,14 +329,14 @@ SHABBAT_PARAMS = [
|
||||
"New York",
|
||||
dt(2018, 9, 30, 21, 25),
|
||||
{
|
||||
"english_upcoming_candle_lighting": dt(2018, 9, 30, 18, 22),
|
||||
"english_upcoming_havdalah": dt(2018, 10, 2, 19, 17),
|
||||
"english_upcoming_shabbat_candle_lighting": dt(2018, 10, 5, 18, 13),
|
||||
"english_upcoming_shabbat_havdalah": dt(2018, 10, 6, 19, 11),
|
||||
"english_parshat_hashavua": "Bereshit",
|
||||
"hebrew_parshat_hashavua": "בראשית",
|
||||
"english_holiday": "Shmini Atzeret",
|
||||
"hebrew_holiday": "שמיני עצרת",
|
||||
"en_upcoming_candle_lighting": dt(2018, 9, 30, 18, 22),
|
||||
"en_upcoming_havdalah": dt(2018, 10, 2, 19, 17),
|
||||
"en_upcoming_shabbat_candle_lighting": dt(2018, 10, 5, 18, 13),
|
||||
"en_upcoming_shabbat_havdalah": dt(2018, 10, 6, 19, 11),
|
||||
"en_parshat_hashavua": "Bereshit",
|
||||
"he_parshat_hashavua": "בראשית",
|
||||
"en_holiday": "Shmini Atzeret",
|
||||
"he_holiday": "שמיני עצרת",
|
||||
},
|
||||
None,
|
||||
id="currently_first_day_of_two_day_yomtov_in_diaspora",
|
||||
@ -345,14 +345,14 @@ SHABBAT_PARAMS = [
|
||||
"New York",
|
||||
dt(2018, 10, 1, 21, 25),
|
||||
{
|
||||
"english_upcoming_candle_lighting": dt(2018, 9, 30, 18, 22),
|
||||
"english_upcoming_havdalah": dt(2018, 10, 2, 19, 17),
|
||||
"english_upcoming_shabbat_candle_lighting": dt(2018, 10, 5, 18, 13),
|
||||
"english_upcoming_shabbat_havdalah": dt(2018, 10, 6, 19, 11),
|
||||
"english_parshat_hashavua": "Bereshit",
|
||||
"hebrew_parshat_hashavua": "בראשית",
|
||||
"english_holiday": "Simchat Torah",
|
||||
"hebrew_holiday": "שמחת תורה",
|
||||
"en_upcoming_candle_lighting": dt(2018, 9, 30, 18, 22),
|
||||
"en_upcoming_havdalah": dt(2018, 10, 2, 19, 17),
|
||||
"en_upcoming_shabbat_candle_lighting": dt(2018, 10, 5, 18, 13),
|
||||
"en_upcoming_shabbat_havdalah": dt(2018, 10, 6, 19, 11),
|
||||
"en_parshat_hashavua": "Bereshit",
|
||||
"he_parshat_hashavua": "בראשית",
|
||||
"en_holiday": "Simchat Torah",
|
||||
"he_holiday": "שמחת תורה",
|
||||
},
|
||||
None,
|
||||
id="currently_second_day_of_two_day_yomtov_in_diaspora",
|
||||
@ -361,14 +361,14 @@ SHABBAT_PARAMS = [
|
||||
"Jerusalem",
|
||||
dt(2018, 9, 29, 21, 25),
|
||||
{
|
||||
"english_upcoming_candle_lighting": dt(2018, 9, 30, 17, 46),
|
||||
"english_upcoming_havdalah": dt(2018, 10, 1, 19, 1),
|
||||
"english_upcoming_shabbat_candle_lighting": dt(2018, 10, 5, 17, 39),
|
||||
"english_upcoming_shabbat_havdalah": dt(2018, 10, 6, 18, 54),
|
||||
"english_parshat_hashavua": "Bereshit",
|
||||
"hebrew_parshat_hashavua": "בראשית",
|
||||
"english_holiday": "Hoshana Raba",
|
||||
"hebrew_holiday": "הושענא רבה",
|
||||
"en_upcoming_candle_lighting": dt(2018, 9, 30, 17, 46),
|
||||
"en_upcoming_havdalah": dt(2018, 10, 1, 19, 1),
|
||||
"en_upcoming_shabbat_candle_lighting": dt(2018, 10, 5, 17, 39),
|
||||
"en_upcoming_shabbat_havdalah": dt(2018, 10, 6, 18, 54),
|
||||
"en_parshat_hashavua": "Bereshit",
|
||||
"he_parshat_hashavua": "בראשית",
|
||||
"en_holiday": "Hoshana Raba",
|
||||
"he_holiday": "הושענא רבה",
|
||||
},
|
||||
None,
|
||||
id="upcoming_one_day_yom_tov_in_israel",
|
||||
@ -377,14 +377,14 @@ SHABBAT_PARAMS = [
|
||||
"Jerusalem",
|
||||
dt(2018, 9, 30, 21, 25),
|
||||
{
|
||||
"english_upcoming_candle_lighting": dt(2018, 9, 30, 17, 46),
|
||||
"english_upcoming_havdalah": dt(2018, 10, 1, 19, 1),
|
||||
"english_upcoming_shabbat_candle_lighting": dt(2018, 10, 5, 17, 39),
|
||||
"english_upcoming_shabbat_havdalah": dt(2018, 10, 6, 18, 54),
|
||||
"english_parshat_hashavua": "Bereshit",
|
||||
"hebrew_parshat_hashavua": "בראשית",
|
||||
"english_holiday": "Shmini Atzeret, Simchat Torah",
|
||||
"hebrew_holiday": "שמיני עצרת, שמחת תורה",
|
||||
"en_upcoming_candle_lighting": dt(2018, 9, 30, 17, 46),
|
||||
"en_upcoming_havdalah": dt(2018, 10, 1, 19, 1),
|
||||
"en_upcoming_shabbat_candle_lighting": dt(2018, 10, 5, 17, 39),
|
||||
"en_upcoming_shabbat_havdalah": dt(2018, 10, 6, 18, 54),
|
||||
"en_parshat_hashavua": "Bereshit",
|
||||
"he_parshat_hashavua": "בראשית",
|
||||
"en_holiday": "Shmini Atzeret, Simchat Torah",
|
||||
"he_holiday": "שמיני עצרת, שמחת תורה",
|
||||
},
|
||||
None,
|
||||
id="currently_one_day_yom_tov_in_israel",
|
||||
@ -393,12 +393,12 @@ SHABBAT_PARAMS = [
|
||||
"Jerusalem",
|
||||
dt(2018, 10, 1, 21, 25),
|
||||
{
|
||||
"english_upcoming_candle_lighting": dt(2018, 10, 5, 17, 39),
|
||||
"english_upcoming_havdalah": dt(2018, 10, 6, 18, 54),
|
||||
"english_upcoming_shabbat_candle_lighting": dt(2018, 10, 5, 17, 39),
|
||||
"english_upcoming_shabbat_havdalah": dt(2018, 10, 6, 18, 54),
|
||||
"english_parshat_hashavua": "Bereshit",
|
||||
"hebrew_parshat_hashavua": "בראשית",
|
||||
"en_upcoming_candle_lighting": dt(2018, 10, 5, 17, 39),
|
||||
"en_upcoming_havdalah": dt(2018, 10, 6, 18, 54),
|
||||
"en_upcoming_shabbat_candle_lighting": dt(2018, 10, 5, 17, 39),
|
||||
"en_upcoming_shabbat_havdalah": dt(2018, 10, 6, 18, 54),
|
||||
"en_parshat_hashavua": "Bereshit",
|
||||
"he_parshat_hashavua": "בראשית",
|
||||
},
|
||||
None,
|
||||
id="after_one_day_yom_tov_in_israel",
|
||||
@ -407,14 +407,14 @@ SHABBAT_PARAMS = [
|
||||
"New York",
|
||||
dt(2016, 6, 11, 8, 25),
|
||||
{
|
||||
"english_upcoming_candle_lighting": dt(2016, 6, 10, 20, 9),
|
||||
"english_upcoming_havdalah": dt(2016, 6, 13, 21, 19),
|
||||
"english_upcoming_shabbat_candle_lighting": dt(2016, 6, 10, 20, 9),
|
||||
"english_upcoming_shabbat_havdalah": "unknown",
|
||||
"english_parshat_hashavua": "Bamidbar",
|
||||
"hebrew_parshat_hashavua": "במדבר",
|
||||
"english_holiday": "Erev Shavuot",
|
||||
"hebrew_holiday": "ערב שבועות",
|
||||
"en_upcoming_candle_lighting": dt(2016, 6, 10, 20, 9),
|
||||
"en_upcoming_havdalah": dt(2016, 6, 13, 21, 19),
|
||||
"en_upcoming_shabbat_candle_lighting": dt(2016, 6, 10, 20, 9),
|
||||
"en_upcoming_shabbat_havdalah": "unknown",
|
||||
"en_parshat_hashavua": "Bamidbar",
|
||||
"he_parshat_hashavua": "במדבר",
|
||||
"en_holiday": "Erev Shavuot",
|
||||
"he_holiday": "ערב שבועות",
|
||||
},
|
||||
None,
|
||||
id="currently_first_day_of_three_day_type1_yomtov_in_diaspora", # Type 1 = Sat/Sun/Mon
|
||||
@ -423,14 +423,14 @@ SHABBAT_PARAMS = [
|
||||
"New York",
|
||||
dt(2016, 6, 12, 8, 25),
|
||||
{
|
||||
"english_upcoming_candle_lighting": dt(2016, 6, 10, 20, 9),
|
||||
"english_upcoming_havdalah": dt(2016, 6, 13, 21, 19),
|
||||
"english_upcoming_shabbat_candle_lighting": dt(2016, 6, 17, 20, 12),
|
||||
"english_upcoming_shabbat_havdalah": dt(2016, 6, 18, 21, 21),
|
||||
"english_parshat_hashavua": "Nasso",
|
||||
"hebrew_parshat_hashavua": "נשא",
|
||||
"english_holiday": "Shavuot",
|
||||
"hebrew_holiday": "שבועות",
|
||||
"en_upcoming_candle_lighting": dt(2016, 6, 10, 20, 9),
|
||||
"en_upcoming_havdalah": dt(2016, 6, 13, 21, 19),
|
||||
"en_upcoming_shabbat_candle_lighting": dt(2016, 6, 17, 20, 12),
|
||||
"en_upcoming_shabbat_havdalah": dt(2016, 6, 18, 21, 21),
|
||||
"en_parshat_hashavua": "Nasso",
|
||||
"he_parshat_hashavua": "נשא",
|
||||
"en_holiday": "Shavuot",
|
||||
"he_holiday": "שבועות",
|
||||
},
|
||||
None,
|
||||
id="currently_second_day_of_three_day_type1_yomtov_in_diaspora", # Type 1 = Sat/Sun/Mon
|
||||
@ -439,14 +439,14 @@ SHABBAT_PARAMS = [
|
||||
"Jerusalem",
|
||||
dt(2017, 9, 21, 8, 25),
|
||||
{
|
||||
"english_upcoming_candle_lighting": dt(2017, 9, 20, 17, 58),
|
||||
"english_upcoming_havdalah": dt(2017, 9, 23, 19, 11),
|
||||
"english_upcoming_shabbat_candle_lighting": dt(2017, 9, 22, 17, 56),
|
||||
"english_upcoming_shabbat_havdalah": dt(2017, 9, 23, 19, 11),
|
||||
"english_parshat_hashavua": "Ha'Azinu",
|
||||
"hebrew_parshat_hashavua": "האזינו",
|
||||
"english_holiday": "Rosh Hashana I",
|
||||
"hebrew_holiday": "א' ראש השנה",
|
||||
"en_upcoming_candle_lighting": dt(2017, 9, 20, 17, 58),
|
||||
"en_upcoming_havdalah": dt(2017, 9, 23, 19, 11),
|
||||
"en_upcoming_shabbat_candle_lighting": dt(2017, 9, 22, 17, 56),
|
||||
"en_upcoming_shabbat_havdalah": dt(2017, 9, 23, 19, 11),
|
||||
"en_parshat_hashavua": "Ha'Azinu",
|
||||
"he_parshat_hashavua": "האזינו",
|
||||
"en_holiday": "Rosh Hashana I",
|
||||
"he_holiday": "א' ראש השנה",
|
||||
},
|
||||
None,
|
||||
id="currently_first_day_of_three_day_type2_yomtov_in_israel", # Type 2 = Thurs/Fri/Sat
|
||||
@ -455,14 +455,14 @@ SHABBAT_PARAMS = [
|
||||
"Jerusalem",
|
||||
dt(2017, 9, 22, 8, 25),
|
||||
{
|
||||
"english_upcoming_candle_lighting": dt(2017, 9, 20, 17, 58),
|
||||
"english_upcoming_havdalah": dt(2017, 9, 23, 19, 11),
|
||||
"english_upcoming_shabbat_candle_lighting": dt(2017, 9, 22, 17, 56),
|
||||
"english_upcoming_shabbat_havdalah": dt(2017, 9, 23, 19, 11),
|
||||
"english_parshat_hashavua": "Ha'Azinu",
|
||||
"hebrew_parshat_hashavua": "האזינו",
|
||||
"english_holiday": "Rosh Hashana II",
|
||||
"hebrew_holiday": "ב' ראש השנה",
|
||||
"en_upcoming_candle_lighting": dt(2017, 9, 20, 17, 58),
|
||||
"en_upcoming_havdalah": dt(2017, 9, 23, 19, 11),
|
||||
"en_upcoming_shabbat_candle_lighting": dt(2017, 9, 22, 17, 56),
|
||||
"en_upcoming_shabbat_havdalah": dt(2017, 9, 23, 19, 11),
|
||||
"en_parshat_hashavua": "Ha'Azinu",
|
||||
"he_parshat_hashavua": "האזינו",
|
||||
"en_holiday": "Rosh Hashana II",
|
||||
"he_holiday": "ב' ראש השנה",
|
||||
},
|
||||
None,
|
||||
id="currently_second_day_of_three_day_type2_yomtov_in_israel", # Type 2 = Thurs/Fri/Sat
|
||||
@ -471,14 +471,14 @@ SHABBAT_PARAMS = [
|
||||
"Jerusalem",
|
||||
dt(2017, 9, 23, 8, 25),
|
||||
{
|
||||
"english_upcoming_candle_lighting": dt(2017, 9, 20, 17, 58),
|
||||
"english_upcoming_havdalah": dt(2017, 9, 23, 19, 11),
|
||||
"english_upcoming_shabbat_candle_lighting": dt(2017, 9, 22, 17, 56),
|
||||
"english_upcoming_shabbat_havdalah": dt(2017, 9, 23, 19, 11),
|
||||
"english_parshat_hashavua": "Ha'Azinu",
|
||||
"hebrew_parshat_hashavua": "האזינו",
|
||||
"english_holiday": "",
|
||||
"hebrew_holiday": "",
|
||||
"en_upcoming_candle_lighting": dt(2017, 9, 20, 17, 58),
|
||||
"en_upcoming_havdalah": dt(2017, 9, 23, 19, 11),
|
||||
"en_upcoming_shabbat_candle_lighting": dt(2017, 9, 22, 17, 56),
|
||||
"en_upcoming_shabbat_havdalah": dt(2017, 9, 23, 19, 11),
|
||||
"en_parshat_hashavua": "Ha'Azinu",
|
||||
"he_parshat_hashavua": "האזינו",
|
||||
"en_holiday": "",
|
||||
"he_holiday": "",
|
||||
},
|
||||
None,
|
||||
id="currently_third_day_of_three_day_type2_yomtov_in_israel", # Type 2 = Thurs/Fri/Sat
|
||||
@ -486,7 +486,7 @@ SHABBAT_PARAMS = [
|
||||
]
|
||||
|
||||
|
||||
@pytest.mark.parametrize("language", ["english", "hebrew"])
|
||||
@pytest.mark.parametrize("language", ["en", "he"])
|
||||
@pytest.mark.parametrize(
|
||||
("location_data", "test_time", "results", "havdalah_offset"),
|
||||
SHABBAT_PARAMS,
|
||||
|
Loading…
x
Reference in New Issue
Block a user