def test_he_bible_ref(self): bible_ref = u"אם נביא הוא נבואתו מסתלקת ממנו מדבורה דכתיב (שופטים ה, ז) חדלו פרזון בישראל" false_pos = u"תלמוד לומר (דברים טז, יח) שופטים תתן שוטרים" res = library.get_titles_in_string(bible_ref, "he") assert set(res) >= {u"שופטים"} res = library.get_titles_in_string(false_pos, "he") assert set(res) >= {u"שופטים", u"דברים"}
def test_he_positions(self): bible_begin = ( u"(שמות כא, ד) אם אדוניו יתן לו אשה" ) # These work, even though the presentation of the parens may be confusing. bible_mid = u"בד (שמות כא, ד) אם אדוניו יתן לו" bible_end = u"אמר קרא (שמות כא, ד)" for a in [bible_mid, bible_begin, bible_end]: assert {u"שמות"} <= set(library.get_titles_in_string(a, "he"))
def test_multi_titles(self): two_ref = u"This is a test of a Brachot 7b and also of an Isaiah 12:13." res = library.get_titles_in_string(two_ref) assert set(res) >= {'Brachot', 'Isaiah'}
def test_positions(self): bible_mid = u"Here we have Genesis 3:5 may it be blessed" bible_begin = u"Genesis 3:5 in the house" bible_end = u"Let there be Genesis 3:5" for a in [bible_mid, bible_begin, bible_end]: assert {'Genesis'} <= set(library.get_titles_in_string(a))
def test_no_bare_number(self): barenum = u"In this text, there is no reference but there is 1 bare number." res = library.get_titles_in_string(barenum) assert set(res) == set()
def test_no_bare_number(self): barenum = u"In this text, there is no reference but there is 1 bare number." res = library.get_titles_in_string(barenum) assert set(res) == set()
def test_he_positions(self): bible_begin = u"(שמות כא, ד) אם אדוניו יתן לו אשה" # These work, even though the presentation of the parens may be confusing. bible_mid = u"בד (שמות כא, ד) אם אדוניו יתן לו" bible_end = u"אמר קרא (שמות כא, ד)" for a in [bible_mid, bible_begin, bible_end]: assert {u"שמות"} <= set(library.get_titles_in_string(a, "he"))
def test_multi_titles(self): two_ref = u"This is a test of a Brachot 7b and also of an Isaiah 12:13." res = library.get_titles_in_string(two_ref) assert set(res) >= {'Brachot', 'Isaiah'}
def test_positions(self): bible_mid = u"Here we have Genesis 3:5 may it be blessed" bible_begin = u"Genesis 3:5 in the house" bible_end = u"Let there be Genesis 3:5" for a in [bible_mid, bible_begin, bible_end]: assert {'Genesis'} <= set(library.get_titles_in_string(a))