def assertPunctured(self, doc, rel): "given rel is indeed a puncture in this graph" graph = self.mk_graph(doc) contexts = Context.for_edus(doc) ids = graph_ids(graph) self.assertTrue(is_puncture(graph, contexts, ids[rel.local_id()]), 'failed to detect puncture')
def assertIntact(self, doc, rel): "given rel does not constitute a puncture in this graph" graph = self.mk_graph(doc) contexts = Context.for_edus(doc) ids = graph_ids(graph) self.assertFalse(is_puncture(graph, contexts, ids[rel.local_id()]), 'unexpected puncture')
def test_cdu_chain(self): "containment chain: c2[c1[e1.1 e1.2]]" c1 = FakeCDU('c1', [self.edu1_1, self.edu1_2]) c2 = FakeCDU('c2', [self.edu1_3, c1]) doc = FakeDocument(self.edus1, [], [c1, c2]) g = self.mk_graph(doc) ids = graph_ids(g) def get_id(x): "anno id as seen by the graph" return g.mirror(ids[x.local_id()]) mark = self.edu1_2.local_id() self.assertEqual([get_id(y) for y in [c1, c2]], g.containing_cdu_chain(ids[mark]))