-
Notifications
You must be signed in to change notification settings - Fork 52
Expand file tree
/
Copy pathtest_hebrew_date.py
More file actions
32 lines (23 loc) · 1000 Bytes
/
test_hebrew_date.py
File metadata and controls
32 lines (23 loc) · 1000 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from datetime import datetime
from pyluach import dates
from app.internal.hebrew_date_view import (
get_hebrew_date,
from_greogian_to_hebrew_date,
get_month_name_by_num,
)
DAY = datetime.strptime("2021-01-01", "%Y-%m-%d").date()
ADAR = datetime.strptime("2021-02-15", "%Y-%m-%d").date()
ADAR_A = datetime.strptime("2019-02-15", "%Y-%m-%d").date()
ADAR_B = datetime.strptime("2019-03-08", "%Y-%m-%d").date()
def test_get_hebrew_date():
result = get_hebrew_date(DAY)
assert result == "י״ז טבת תשפ״א"
def test_from_greogian_to_hebrew_date_and_find_month_name():
result = from_greogian_to_hebrew_date(ADAR)
assert result == dates.HebrewDate(5781, 12, 3)
assert get_month_name_by_num(result) == 'אדר'
def test_if_leap_year():
result_a = from_greogian_to_hebrew_date(ADAR_A)
result_b = from_greogian_to_hebrew_date(ADAR_B)
assert get_month_name_by_num(result_a) == "אדר(א')"
assert get_month_name_by_num(result_b) == "אדר(ב')"