Example #1
0
 def test_immediately_follows_without_words(self):
     first = SegmentMap(Ref("Shabbat 7a:23"), Ref("Shabbat 7a:25"))
     second = SegmentMap(Ref("Shabbat 7a:26"), Ref("Shabbat 7a:28"))
     third = SegmentMap(Ref("Shabbat 7a:29"), Ref("Shabbat 7a:29"))
     fourth = SegmentMap(Ref("Shabbat 7a:30"), Ref("Shabbat 7a:31"))
     assert second.immediately_follows(first)
     assert third.immediately_follows(second)
     assert fourth.immediately_follows(third)
     assert not fourth.immediately_follows(second)
     assert not fourth.immediately_follows(first)
Example #2
0
    def test_adjustment(self):
        assert len(
            self.splicer.adjusted_segment_maps)  # Did it derive the new ones?

        target = [
            SegmentMap(Ref("Shabbat 2b:1"), Ref("Shabbat 2b:2")),
            SegmentMap(Ref("Shabbat 2b:3"), Ref("Shabbat 2b:5")),
            SegmentMap(Ref("Shabbat 2b:6"), Ref("Shabbat 2b:12")),
            SegmentMap(Ref("Shabbat 2b:13"), Ref("Shabbat 2b:15")),
            SegmentMap(Ref("Shabbat 2b:16"), Ref("Shabbat 2b:17")),
            SegmentMap(Ref("Shabbat 2b:18"), Ref("Shabbat 2b:18")),
            BlankSegment(),
            SegmentMap(Ref("Shabbat 2b:19"), Ref("Shabbat 2b:29")),
        ]

        assert self.splicer.adjusted_segment_maps == target
Example #3
0
    def test_immediately_follows_with_words(self):
        first = SegmentMap(Ref("Shabbat 7a:23"),
                           Ref("Shabbat 7a:25"),
                           end_word=3)
        second = SegmentMap(Ref("Shabbat 7a:25"),
                            Ref("Shabbat 7a:28"),
                            start_word=4,
                            end_word=6)
        third = SegmentMap(Ref("Shabbat 7a:28"),
                           Ref("Shabbat 7a:28"),
                           start_word=7,
                           end_word=12)
        fourth = SegmentMap(Ref("Shabbat 7a:28"),
                            Ref("Shabbat 7a:31"),
                            start_word=13)
        assert second.immediately_follows(first)
        assert third.immediately_follows(second)
        assert fourth.immediately_follows(third)
        assert not fourth.immediately_follows(second)
        assert not fourth.immediately_follows(first)

        gapped_third = SegmentMap(Ref("Shabbat 7a:28"),
                                  Ref("Shabbat 7a:28"),
                                  start_word=8,
                                  end_word=11)
        assert not gapped_third.immediately_follows(second)
        assert not fourth.immediately_follows(gapped_third)

        overlapping_third = SegmentMap(Ref("Shabbat 7a:28"),
                                       Ref("Shabbat 7a:28"),
                                       start_word=6,
                                       end_word=13)
        assert not overlapping_third.immediately_follows(second)
        assert not fourth.immediately_follows(overlapping_third)
Example #4
0
 def test_immediately_follows_without_words(self):
     first = SegmentMap(Ref("Shabbat 7a:23"), Ref("Shabbat 7a:25"))
     second = SegmentMap(Ref("Shabbat 7a:26"), Ref("Shabbat 7a:28"))
     third = SegmentMap(Ref("Shabbat 7a:29"), Ref("Shabbat 7a:29"))
     fourth = SegmentMap(Ref("Shabbat 7a:30"), Ref("Shabbat 7a:31"))
     assert second.immediately_follows(first)
     assert third.immediately_follows(second)
     assert fourth.immediately_follows(third)
     assert not fourth.immediately_follows(second)
     assert not fourth.immediately_follows(first)
Example #5
0
    def test_immediately_follows_with_words(self):
        first = SegmentMap(Ref("Shabbat 7a:23"), Ref("Shabbat 7a:25"), end_word=3)
        second = SegmentMap(Ref("Shabbat 7a:25"), Ref("Shabbat 7a:28"), start_word=4, end_word=6)
        third = SegmentMap(Ref("Shabbat 7a:28"), Ref("Shabbat 7a:28"), start_word=7, end_word=12)
        fourth = SegmentMap(Ref("Shabbat 7a:28"), Ref("Shabbat 7a:31"), start_word=13)
        assert second.immediately_follows(first)
        assert third.immediately_follows(second)
        assert fourth.immediately_follows(third)
        assert not fourth.immediately_follows(second)
        assert not fourth.immediately_follows(first)

        gapped_third = SegmentMap(Ref("Shabbat 7a:28"), Ref("Shabbat 7a:28"), start_word=8, end_word=11)
        assert not gapped_third.immediately_follows(second)
        assert not fourth.immediately_follows(gapped_third)

        overlapping_third = SegmentMap(Ref("Shabbat 7a:28"), Ref("Shabbat 7a:28"), start_word=6, end_word=13)
        assert not overlapping_third.immediately_follows(second)
        assert not fourth.immediately_follows(overlapping_third)