Пример #1
0
 def test_same_span(self):
     s1_5 = NullAnno(1, 5, 'out')
     s2_4a = NullAnno(2, 4, 'a')
     s2_4b = NullAnno(2, 4, 'b')
     s3_4 = NullAnno(3, 4, 'in')
     g = EnclosureGraph([s1_5, s2_4a, s2_4b, s3_4])
     self.assertEqual([s2_4a, s2_4b], g.inside(s1_5))
     self.assertEqual([s3_4], g.inside(s2_4a))
     self.assertEqual([s3_4], g.inside(s2_4b))
     self.assertEqual([s2_4a, s2_4b], g.outside(s3_4))
Пример #2
0
 def test_same_span(self):
     s1_5 = NullAnno(1, 5, 'out')
     s2_4a = NullAnno(2, 4, 'a')
     s2_4b = NullAnno(2, 4, 'b')
     s3_4 = NullAnno(3, 4, 'in')
     g = EnclosureGraph([s1_5, s2_4a, s2_4b, s3_4])
     self.assertEqual([s2_4a, s2_4b], g.inside(s1_5))
     self.assertEqual([s3_4], g.inside(s2_4a))
     self.assertEqual([s3_4], g.inside(s2_4b))
     self.assertEqual([s2_4a, s2_4b], g.outside(s3_4))
Пример #3
0
 def test_layers(self):
     s3_4 = NullAnno(3, 4)
     s2_4 = NullAnno(2, 4)
     s3_5 = NullAnno(3, 5)
     g = EnclosureGraph([s3_4, s2_4, s3_5])
     self.assertEqual([s3_4], g.inside(s3_5))
     self.assertEqual([s3_4], g.inside(s2_4))
     self.assertEqual([s2_4, s3_5], g.outside(s3_4))
Пример #4
0
 def test_indirect_enclosure(self):
     s1_5 = NullAnno(1, 5, 'a')
     s2_4 = NullAnno(2, 4, 'b')
     s3_4 = NullAnno(3, 4, 'c')
     g = EnclosureGraph([s1_5, s2_4, s3_4])
     self.assertEqual([s2_4], g.inside(s1_5))
     self.assertEqual([s1_5], g.outside(s2_4))
     self.assertEqual([s2_4], g.outside(s3_4))
Пример #5
0
 def test_layers(self):
     s3_4 = NullAnno(3, 4)
     s2_4 = NullAnno(2, 4)
     s3_5 = NullAnno(3, 5)
     g = EnclosureGraph([s3_4, s2_4, s3_5])
     self.assertEqual([s3_4], g.inside(s3_5))
     self.assertEqual([s3_4], g.inside(s2_4))
     self.assertEqual([s2_4, s3_5], g.outside(s3_4))
Пример #6
0
 def test_indirect_enclosure(self):
     s1_5 = NullAnno(1, 5, 'a')
     s2_4 = NullAnno(2, 4, 'b')
     s3_4 = NullAnno(3, 4, 'c')
     g = EnclosureGraph([s1_5, s2_4, s3_4])
     self.assertEqual([s2_4], g.inside(s1_5))
     self.assertEqual([s1_5], g.outside(s2_4))
     self.assertEqual([s2_4], g.outside(s3_4))
Пример #7
0
 def test_indirect_enclosure_untyped(self):
     """
     reduce only pays attention to nodes of different type
     """
     s_1_5 = NullAnno(1, 5)
     s_2_4 = NullAnno(2, 4)
     s_3_4 = NullAnno(3, 4)
     g = EnclosureGraph([s_1_5, s_2_4, s_3_4])
     self.assertEqual([s_2_4, s_3_4], g.inside(s_1_5))
     self.assertEqual([s_1_5], g.outside(s_2_4))
     self.assertEqual([s_1_5, s_2_4], g.outside(s_3_4))
Пример #8
0
 def test_indirect_enclosure_untyped(self):
     """
     reduce only pays attention to nodes of different type
     """
     s_1_5 = NullAnno(1, 5)
     s_2_4 = NullAnno(2, 4)
     s_3_4 = NullAnno(3, 4)
     g = EnclosureGraph([s_1_5, s_2_4, s_3_4])
     self.assertEqual([s_2_4, s_3_4], g.inside(s_1_5))
     self.assertEqual([s_1_5], g.outside(s_2_4))
     self.assertEqual([s_1_5, s_2_4], g.outside(s_3_4))
Пример #9
0
 def test_simple_enclosure(self):
     s1_5 = NullAnno(1, 5)
     s2_3 = NullAnno(2, 3)
     g = EnclosureGraph([s1_5, s2_3])
     self.assertEqual([s2_3], g.inside(s1_5))
     self.assertEqual([s1_5], g.outside(s2_3))
Пример #10
0
 def test_singleton(self):
     s0 = NullAnno(1, 5)
     g = EnclosureGraph([s0])
     self.assertEqual([s0.local_id()], g.nodes())
     self.assertEqual([], g.inside(s0))
     self.assertEqual([], g.outside(s0))
Пример #11
0
 def test_simple_enclosure(self):
     s1_5 = NullAnno(1, 5)
     s2_3 = NullAnno(2, 3)
     g = EnclosureGraph([s1_5, s2_3])
     self.assertEqual([s2_3], g.inside(s1_5))
     self.assertEqual([s1_5], g.outside(s2_3))
Пример #12
0
 def test_singleton(self):
     s0 = NullAnno(1, 5)
     g = EnclosureGraph([s0])
     self.assertEqual([s0.local_id()], g.nodes())
     self.assertEqual([], g.inside(s0))
     self.assertEqual([], g.outside(s0))