コード例 #1
0
 def test_commentary(self):
     s = "Here's one with Rashi on Genesis 2:5:3"
     s2 = "Here's one with both Rashi on Genesis 3:4 and Exodus 5:2. yeah"
     s3 = "Here's one with Genesis 2:3"
     assert library.get_refs_in_string(s, "en") == [Ref("Rashi on Genesis 2:5:3")]
     assert library.get_refs_in_string(s2, "en") == [Ref("Rashi on Genesis 3:4"), Ref("Exodus 5:2")]
     assert library.get_refs_in_string(s3, "en") == [Ref("Genesis 2:3")]
コード例 #2
0
ファイル: library_test.py プロジェクト: zoejf/Sefaria-Project
 def test_commentary(self):
     s = "Here's one with Rashi on Genesis 2:5:3"
     s2 = "Here's one with both Rashi on Genesis 3:4 and Exodus 5:2. yeah"
     s3 = "Here's one with Genesis 2:3"
     assert library.get_refs_in_string(s, "en") == [Ref("Rashi on Genesis 2:5:3")]
     assert library.get_refs_in_string(s2, "en") == [Ref("Rashi on Genesis 3:4"), Ref("Exodus 5:2")]
     assert library.get_refs_in_string(s3, "en") == [Ref("Genesis 2:3")]
コード例 #3
0
    def test_two_single_quotes(self):
        ref = library.get_refs_in_string(u"עין ממש דכתיב (במדבר ל''ה) ולא תקחו")
        assert 1 == len(ref)
        assert ref[0] == Ref(u"במדבר ל''ה")

        ref = library.get_refs_in_string(u"דאמר קרא (שופטים כ י''א) ויאסף כל איש")
        assert 1 == len(ref)
        assert ref[0] == Ref(u"שופטים כ י''א")
コード例 #4
0
    def test_two_single_quotes(self):
        ref = library.get_refs_in_string(u"עין ממש דכתיב (במדבר ל''ה) ולא תקחו")
        assert 1 == len(ref)
        assert ref[0] == Ref(u"במדבר ל''ה")

        ref = library.get_refs_in_string(u"דאמר קרא (שופטים כ י''א) ויאסף כל איש")
        assert 1 == len(ref)
        assert ref[0] == Ref(u"שופטים כ י''א")
コード例 #5
0
    def test_word_boundary(self):
        st = u' את הכל, ובאגדה (אסתר רבה פתיחתא, יא) שמעון בן זומא בשם'
        ref = library.get_refs_in_string(st)
        assert len(ref) == 0

        #Assumes that Yalkut Shimoni Esther is not a text
        st = u"""ובמדרש (ילקוט שמעוני אסתר א, סי' חתרמ"ו) מהיכן היה לו"""
        ref = library.get_refs_in_string(st)
        assert len(ref) == 1
        assert ref[0].sections[0] == 1
        assert len(ref[0].sections) == 1
コード例 #6
0
    def test_word_boundary(self):
        st = u' את הכל, ובאגדה (אסתר רבה פתיחתא, יא) שמעון בן זומא בשם'
        ref = library.get_refs_in_string(st)
        assert len(ref) == 0

        #Assumes that Yalkut Shimoni Esther is not a text
        st = u"""ובמדרש (ילקוט שמעוני אסתר א, סי' חתרמ"ו) מהיכן היה לו"""
        ref = library.get_refs_in_string(st)
        assert len(ref) == 1
        assert ref[0].sections[0] == 1
        assert len(ref[0].sections) == 1
コード例 #7
0
ファイル: library_test.py プロジェクト: zoejf/Sefaria-Project
    def test_FAILING_huge_second_addr(self):
        st = u"""וכן הוא בב"ר (ילקוט שמעוני אסתר א, תתרמו) א"ר לוי בגדי כהונה"""
        ref = library.get_refs_in_string(st)[0]
        assert ref.sections[0] == 1
        assert len(ref.sections) == 1

        ''' These only work in the js
コード例 #8
0
 def test_double_talmud(self):
     ''' includes  ב''ק - why would that work?'''
     #ref = lib.get_refs_in_string(texts['2talmud'])
     #assert 2 == len(ref)
     ''' includes  ב"ק '''
     ref = library.get_refs_in_string(texts['bk-abbrev'])
     assert 2 == len(ref)
コード例 #9
0
    def test_huge_second_addr(self):
        st = u"""וכן הוא בב"ר (ילקוט שמעוני אסתר א, תתרמו) א"ר לוי בגדי כהונה"""
        ref = library.get_refs_in_string(st)[0]
        assert ref.sections[0] == 1
        assert len(ref.sections) == 1

        ''' These only work in the js
コード例 #10
0
    def test_inner_parenthesis(self):

        ref = library.get_refs_in_string(u"Bereishit Rabbah (55:7)", "en")
        assert 1 == len(ref)
        assert ref[0] == Ref(u'Bereshit Rabbah 55:7')

        ''' Ranges not yet supported
コード例 #11
0
 def test_double_talmud(self):
     """ includes  ב''ק - why would that work?"""
     # ref = lib.get_refs_in_string(texts['2talmud'])
     # assert 2 == len(ref)
     """ includes  ב"ק """
     ref = library.get_refs_in_string(texts["bk-abbrev"])
     assert 2 == len(ref)
コード例 #12
0
ファイル: library_test.py プロジェクト: zoejf/Sefaria-Project
    def test_inner_parenthesis(self):

        ref = library.get_refs_in_string(u"Bereishit Rabbah (55:7)", "en")
        assert 1 == len(ref)
        assert ref[0] == Ref(u'Bereshit Rabbah 55:7')

        ''' Ranges not yet supported
コード例 #13
0
 def test_double_talmud(self):
     ''' includes  ב''ק - why would that work?'''
     #ref = lib.get_refs_in_string(texts['2talmud'])
     #assert 2 == len(ref)
     ''' includes  ב"ק '''
     ref = library.get_refs_in_string(texts['bk-abbrev'])
     assert 2 == len(ref)
コード例 #14
0
 def test_sefer_mitzvot(self):
     ref = library.get_refs_in_string(texts['neg327'])
     assert 4 == len(ref)
     assert {
         Ref(u'ויקרא טז,כט'),
         Ref(u'ויקרא כג,כח'),
         Ref(u'ויקרא כג,לא'),
         Ref(u'במדבר כט,ז')
     } == set(ref)
コード例 #15
0
    def test_inner_parenthesis(self):

        ref = library.get_refs_in_string(u"Bereishit Rabbah (55:7)", "en")
        assert 1 == len(ref)
        assert ref[0] == Ref(u'Bereshit Rabbah 55:7')

        ''' These only work in the js
        ref = library.get_refs_in_string(u'במסכת שבועות (ל, ע"א) - כיצד אפוא', "he")
        assert 1 == len(ref)
        assert ref[0] == Ref(u'Shavuot 30a')

        ref = library.get_refs_in_string(u"במשנה, מסכת נדה (פרק ו, משנה ד), נקבע", "he")
        assert 1 == len(ref)
        assert ref[0] == Ref(u'Mishnah Nidah 6:4')
        '''
        ''' Ranges not yet supported
コード例 #16
0
 def test_divrei_hayamim(self):
     ref = library.get_refs_in_string(u"(דברי הימים ב לב, יט)")
     assert 1 == len(ref)
コード例 #17
0
 def test_sefer_mitzvot(self):
     ref = library.get_refs_in_string(texts["neg327"])
     assert 4 == len(ref)
     assert {Ref(u"ויקרא טז,כט"), Ref(u"ויקרא כג,כח"), Ref(u"ויקרא כג,לא"), Ref(u"במדבר כט,ז")} == set(ref)
コード例 #18
0
 def test_positions(self):
     for a in ['he_bible_mid', 'he_bible_begin', 'he_bible_end']:
         ref = library.get_refs_in_string(texts[a])
         assert 1 == len(ref)
         assert ref[0] == Ref(u"שמות כא, ד")
コード例 #19
0
 def test_with_lead(self):
     ref = library.get_refs_in_string(texts["2with_lead"])
     assert 2 == len(ref)
     assert {Ref(u"דברים ד,ח"), Ref(u"דברים ד,ז")} == set(ref)
コード例 #20
0
 def test_positions(self):
     for a in ['bible_mid','bible_begin', 'bible_end']:
         ref = library.get_refs_in_string(texts[a])
         assert 1 == len(ref)
         assert ref[0] == Ref("Genesis 3:5")
コード例 #21
0
 def test_nikkud_stripping(self):
     st = u' בִּשְׁמוֹ שֶׁאָמַר שֶׁזֶּה בְּחִינַת (יְשְׁעַיָה ל"ח): "וַיַּסֵּב חִזְקִיָּהוּ פָּנָיו'
     ref = library.get_refs_in_string(st)
     assert len(ref) == 1
コード例 #22
0
 def test_beyond_length(self):
     ref = library.get_refs_in_string(u'דתנן (דברים שם) דכל (דברים ל, א) צריך')
     assert 1 == len(ref)
     assert ref[0] == Ref(u'דברים ל, א')
コード例 #23
0
 def test_false_positive(self):
     ref = library.get_refs_in_string(texts['false_pos'])
     assert 1 == len(ref)
     assert ref[0] == Ref(u"דברים טז, יח")
コード例 #24
0
 def test_divrei_hayamim(self):
     ref = library.get_refs_in_string(u"(דברי הימים ב לב, יט)")
     assert 1 == len(ref)
コード例 #25
0
 def test_multiple(self):
     ref = library.get_refs_in_string(texts['2ref'])
     assert 2 == len(ref)
     assert {Ref('Brachot 7b'), Ref('Isaiah 12:13')} == set(library.get_refs_in_string(texts['2ref']))
コード例 #26
0
 def test_positions(self):
     for a in ['he_bible_mid', 'he_bible_begin', 'he_bible_end']:
         ref = library.get_refs_in_string(texts[a])
         assert 1 == len(ref)
         assert ref[0] == Ref(u"שמות כא, ד")
コード例 #27
0
 def test_positions(self):
     for a in ['bible_mid','bible_begin', 'bible_end']:
         ref = library.get_refs_in_string(texts[a])
         assert 1 == len(ref)
         assert ref[0] == Ref("Genesis 3:5")
コード例 #28
0
 def test_bare_digits(self):
     assert set() == set(library.get_refs_in_string(texts['barenum'])) # Fixed in 5a4b813819ef652def8360da2ac1b7539896c732
コード例 #29
0
 def test_beyond_length(self):
     ref = library.get_refs_in_string(u'דתנן (דברים שם) דכל (דברים ל, א) צריך')
     assert 1 == len(ref)
     assert ref[0] == Ref(u'דברים ל, א')
コード例 #30
0
 def test_double_ref(self):
     ref = library.get_refs_in_string(texts['he_2ref'])
     assert 2 == len(ref)
     assert {Ref(u'הושע ט ג'), Ref(u'דברי הימים ב לב יט')} == set(ref)
コード例 #31
0
 def test_three_digit_chapter(self):
     ref = library.get_refs_in_string(texts['3dig'])
     assert 1 == len(ref)
     assert Ref(u'תהילים קי"ט') == ref[0]
コード例 #32
0
 def test_spelled_mishnah(self):
     ref = library.get_refs_in_string(u'דתנן (טהרות פ"ג משנה ב) רמ אומר')
     assert 1 == len(ref)
     assert ref[0] == Ref(u'טהרות פ"ג משנה ב')
コード例 #33
0
 def test_double_ref(self):
     ref = library.get_refs_in_string(texts['he_2ref'])
     assert 2 == len(ref)
     assert {Ref(u'הושע ט ג'), Ref(u'דברי הימים ב לב יט')} == set(ref)
コード例 #34
0
 def test_spelled_mishnah(self):
     ref = library.get_refs_in_string(u'דתנן (טהרות פ"ג משנה ב) רמ אומר')
     assert 1 == len(ref)
     assert ref[0] == Ref(u'טהרות פ"ג משנה ב')
コード例 #35
0
 def test_out_of_brackets(self):
     ref = library.get_refs_in_string(texts['ignored_middle'])
     assert 2 == len(ref)
コード例 #36
0
 def test_multiple(self):
     ref = library.get_refs_in_string(texts["2ref"])
     assert 2 == len(ref)
     assert {Ref("Brachot 7b"), Ref("Isaiah 12:13")} == set(library.get_refs_in_string(texts["2ref"]))
コード例 #37
0
 def test_double_quote_talmud(self):
     ref = library.get_refs_in_string(texts['dq_talmud'])
     assert 1 == len(ref)
     assert Ref(u'יבמות ס"ה') == ref[0]
コード例 #38
0
 def test_bare_digits(self):
     assert set() == set(library.get_refs_in_string(texts['barenum'])) # Fixed in 5a4b813819ef652def8360da2ac1b7539896c732
コード例 #39
0
 def test_out_of_brackets(self):
     ref = library.get_refs_in_string(texts['ignored_middle'])
     assert 2 == len(ref)
コード例 #40
0
 def test_multiple(self):
     ref = library.get_refs_in_string(texts['2ref'])
     assert 2 == len(ref)
     assert {Ref('Brachot 7b'), Ref('Isaiah 12:13')} == set(library.get_refs_in_string(texts['2ref']))
コード例 #41
0
 def test_double_quote_talmud(self):
     ref = library.get_refs_in_string(texts['dq_talmud'])
     assert 1 == len(ref)
     assert Ref(u'יבמות ס"ה') == ref[0]
コード例 #42
0
 def test_double_ref(self):
     ref = library.get_refs_in_string(texts["he_2ref"])
     assert 2 == len(ref)
     assert {Ref(u"הושע ט ג"), Ref(u"דברי הימים ב לב יט")} == set(ref)
コード例 #43
0
 def test_sefer_mitzvot(self):
     ref = library.get_refs_in_string(texts['neg327'])
     assert 4 == len(ref)
     assert {Ref(u'ויקרא טז,כט'), Ref(u'ויקרא כג,כח'), Ref(u'ויקרא כג,לא'), Ref(u'במדבר כט,ז')} == set(ref)
コード例 #44
0
 def test_false_positive(self):
     ref = library.get_refs_in_string(texts['false_pos'])
     assert 1 == len(ref)
     assert ref[0] == Ref(u"דברים טז, יח")
コード例 #45
0
 def test_three_digit_chapter(self):
     ref = library.get_refs_in_string(texts['3dig'])
     assert 1 == len(ref)
     assert Ref(u'תהילים קי"ט') == ref[0]
コード例 #46
0
 def test_double_ref_alt(self):
     ref = library.get_refs_in_string(u"עמי הארץ (דברי הימים ב לב,יט), וכתיב (הושע ט ג): לא ישבו בארץ")
     assert 2 == len(ref)
コード例 #47
0
 def test_with_lead(self):
     ref = library.get_refs_in_string(texts['2with_lead'])
     assert 2 == len(ref)
     assert {Ref(u'דברים ד,ח'), Ref(u'דברים ד,ז')} == set(ref)
コード例 #48
0
 def test_double_ref_alt(self):
     ref = library.get_refs_in_string(u"עמי הארץ (דברי הימים ב לב,יט), וכתיב (הושע ט ג): לא ישבו בארץ")
     assert 2 == len(ref)
コード例 #49
0
 def test_with_lead(self):
     ref = library.get_refs_in_string(texts['2with_lead'])
     assert 2 == len(ref)
     assert {Ref(u'דברים ד,ח'), Ref(u'דברים ד,ז')} == set(ref)