Esempio n. 1
0
 def test_issur_melacha_motsaei_pesach_ii(self):
     c = Location(
         name="New York",
         latitude=40.7128,
         longitude=-74.0060,
         timezone="America/New_York",
         diaspora=True,
     )
     z = Zmanim(date=datetime(2019, 4, 21, 20, 30), location=c)
     assert not z.issur_melacha_in_effect
Esempio n. 2
0
 def test_zmanim_localized_datetime(self):
     c = Location(
         name="New York",
         latitude=40.7128,
         longitude=-74.0060,
         timezone="America/New_York",
         diaspora=True,
     )
     z = Zmanim(date=c.timezone.localize(datetime(2019, 4, 21, 20, 30)),
                location=c)
     assert not z.issur_melacha_in_effect
Esempio n. 3
0
 def test_readme_example_english(self, capsys):
     c = Location("פתח תקוה", 32.08707, 34.88747, "Asia/Jerusalem", 54)
     z = Zmanim(date=date(2016, 4, 18), location=c, hebrew=False)
     print(z)
     captured = capsys.readouterr()
     assert (captured.out == "Alot HaShachar - 04:53:00\n"
             "Talit & Tefilin's time - 05:19:00\n"
             "Sunrise - 06:09:00\n"
             'Shema EOT MG"A - 08:46:00\n'
             'Shema EOT GR"A - 09:24:00\n'
             'Tefila EOT MG"A - 10:03:40\n'
             'Tefila EOT GR"A - 10:29:00\n'
             "Midday - 12:39:00\n"
             "Big Mincha - 13:11:30\n"
             "Small Mincha - 16:26:30\n"
             "Plag Mincha - 17:48:45\n"
             "Sunset - 19:10:00\n"
             "First stars - 19:35:00\n"
             "Midnight - 00:39:00\n\n")
Esempio n. 4
0
 def test_readme_example_hebrew(self, capsys):
     c = Location("פתח תקוה", 32.08707, 34.88747, "Asia/Jerusalem", 54)
     z = Zmanim(date=date(2016, 4, 18), location=c)
     print(z)
     captured = capsys.readouterr()
     assert (captured.out == u"עלות השחר - 04:53:00\n"
             u"זמן טלית ותפילין - 05:19:00\n"
             u"הנץ החמה - 06:09:00\n"
             u'סוף זמן ק"ש מג"א - 08:46:00\n'
             u'סוף זמן ק"ש הגר"א - 09:24:00\n'
             u'סוף זמן תפילה מג"א - 10:03:40\n'
             u'סוף זמן תפילה גר"א - 10:29:00\n'
             u"חצות היום - 12:39:00\n"
             u"מנחה גדולה - 13:11:30\n"
             u"מנחה קטנה - 16:26:30\n"
             u"פלג מנחה - 17:48:45\n"
             u"שקיעה - 19:10:00\n"
             u"צאת הככבים - 19:35:00\n"
             u"חצות הלילה - 00:39:00\n\n")
Esempio n. 5
0
 def test_readme_example_hebrew(self, capsys):
     c = Location("פתח תקוה", 32.08707, 34.88747, "Asia/Jerusalem", 54)
     z = Zmanim(date=date(2016, 4, 18), location=c)
     print(z)
     captured = capsys.readouterr()
     if not _ASTRAL:
         return
     assert (captured.out == u"עלות השחר - 04:52:00\n"
             u"זמן טלית ותפילין - 05:18:00\n"
             u"הנץ החמה - 06:08:00\n"
             u'סוף זמן ק"ש מג"א - 08:46:00\n'
             u'סוף זמן ק"ש גר"א - 09:23:00\n'
             u'סוף זמן תפילה מג"א - 10:04:00\n'
             u'סוף זמן תפילה גר"א - 10:28:00\n'
             u"חצות היום - 12:40:00\n"
             u"מנחה גדולה - 13:10:30\n"
             u"מנחה קטנה - 16:25:30\n"
             u"פלג המנחה - 17:50:45\n"
             u"שקיעה - 19:12:00\n"
             u"צאת הכוכבים - 19:38:00\n"
             u"חצות הלילה - 00:40:00\n\n")
Esempio n. 6
0
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
    """Set up the Jewish Calendar component."""
    if DOMAIN not in config:
        return True

    name = config[DOMAIN][CONF_NAME]
    language = config[DOMAIN][CONF_LANGUAGE]

    latitude = config[DOMAIN].get(CONF_LATITUDE, hass.config.latitude)
    longitude = config[DOMAIN].get(CONF_LONGITUDE, hass.config.longitude)
    diaspora = config[DOMAIN][CONF_DIASPORA]

    candle_lighting_offset = config[DOMAIN][CONF_CANDLE_LIGHT_MINUTES]
    havdalah_offset = config[DOMAIN][CONF_HAVDALAH_OFFSET_MINUTES]

    location = Location(
        latitude=latitude,
        longitude=longitude,
        timezone=hass.config.time_zone,
        diaspora=diaspora,
    )

    prefix = get_unique_prefix(
        location, language, candle_lighting_offset, havdalah_offset
    )
    hass.data[DOMAIN] = {
        "location": location,
        "name": name,
        "language": language,
        "candle_lighting_offset": candle_lighting_offset,
        "havdalah_offset": havdalah_offset,
        "diaspora": diaspora,
        "prefix": prefix,
    }

    for platform in PLATFORMS:
        hass.async_create_task(async_load_platform(hass, platform, DOMAIN, {}, config))

    return True
Esempio n. 7
0
 def test_issur_melacha_weekday(self):
     c = Location("פתח תקוה", 32.08707, 34.88747, "Asia/Jerusalem", 54)
     z = Zmanim(date=date(2018, 11, 12), location=c)
     assert not z.issur_melacha_in_effect
Esempio n. 8
0
 def test_issur_melacha_motsaei_shavuot(self):
     c = Location("פתח תקוה", 32.08707, 34.88747, "Asia/Jerusalem", 54)
     z = Zmanim(date=datetime(2019, 6, 9, 20, 30), location=c)
     assert not z.issur_melacha_in_effect
Esempio n. 9
0
 def test_issur_melacha_shavuot_evening(self):
     c = Location("פתח תקוה", 32.08707, 34.88747, "Asia/Jerusalem", 54)
     z = Zmanim(date=datetime(2019, 6, 8, 21, 45), location=c)
     assert z.issur_melacha_in_effect
Esempio n. 10
0
 def test_issur_melacha_pesach_vi_mornng(self):
     c = Location("פתח תקוה", 32.08707, 34.88747, "Asia/Jerusalem", 54)
     z = Zmanim(date=datetime(2019, 4, 25, 9, 45), location=c)
     assert not z.issur_melacha_in_effect
Esempio n. 11
0
 def test_issur_melacha_motsaei_shabbat(self):
     c = Location("פתח תקוה", 32.08707, 34.88747, "Asia/Jerusalem", 54)
     z = Zmanim(date=datetime(2018, 11, 10, 17, 45), location=c)
     assert not z.issur_melacha_in_effect
Esempio n. 12
0
 def test_issur_melacha_friday_evening(self):
     c = Location("פתח תקוה", 32.08707, 34.88747, "Asia/Jerusalem", 54)
     z = Zmanim(date=datetime(2018, 11, 9, 16, 45), location=c)
     assert z.issur_melacha_in_effect