def test_simple_puncture(self, enclose=False): "c1[e1.1 e1.2]; e1.3 -> e1.2 (puncture)" c1 = FakeCDU('c1', [self.edu1_1, self.edu1_2]) r = FakeRelInst('r', self.edu1_3, self.edu1_2) cdus = self.enclose(self.edu1_3, c1, [c1], enclose) doc = FakeDocument(self.edus1, [r], cdus) self.assertPunctured(doc, r)
def test_non_puncture(self, enclose=False): "c1[e1.1 1.2] -> e1.3 (non-puncture)" c1 = FakeCDU('c1', [self.edu1_1, self.edu1_2]) r = FakeRelInst('r', c1, self.edu1_3) cdus = self.enclose(c1, self.edu1_3, [c1], enclose) doc = FakeDocument(self.edus1, [r], cdus) self.assertIntact(doc, r)
def test_cross_puncture(self, enclose=False): "c1[e1.1 e1.2] c2[e1.3]; e1.3 -> e1.2 (puncture)" c1 = FakeCDU('c1', [self.edu1_1, self.edu1_2]) c2 = FakeCDU('c2', [self.edu1_3]) r = FakeRelInst('r', self.edu1_3, self.edu1_2) cdus = self.enclose(c2, c1, [c1, c2], enclose) doc = FakeDocument(self.edus1, [r], cdus) self.assertPunctured(doc, r)
def test_simple_dangler(self, enclose=False): """ Danglers are not treated as punctures """ c1 = FakeCDU('c1', [self.edu1_1, self.edu1_2]) r = FakeRelInst('r', self.edu1_2, self.edu1_3) cdus = self.enclose(c1, self.edu1_3, [c1], enclose) doc = FakeDocument(self.edus1, [r], cdus) self.assertIntact(doc, r)
def test_double_dangler(self, enclose=False): """ Danglers can poke out of multiple CDUs """ c1 = FakeCDU('c1', [self.edu1_1, self.edu1_2]) c2 = FakeCDU('c2', [c1]) r = FakeRelInst('r', self.edu1_2, self.edu1_3) cdus = self.enclose(c2, self.edu1_3, [c1, c2], enclose) doc = FakeDocument(self.edus1, [r], cdus) self.assertIntact(doc, r)
def test_simple_segment_cross(self): "simple cross-dialogue" src = self.edu1_1 tgt = self.edu2_1 rel = FakeRelInst('r', src, tgt) doc = FakeDocument(self.edus1, [rel], []) contexts = Context.for_edus(doc) cp = doc.copies self.assertTrue(is_cross_dialogue(contexts)(cp[rel]))
def test_cdu_cross(self): "naughty: rel to CDU in another dialogue" cdu = FakeCDU('c1', [self.edu1_1, self.edu1_2]) src = cdu tgt = self.edu2_1 rel = FakeRelInst('r', src, tgt) doc = FakeDocument(self.edus1, [rel], [cdu]) contexts = Context.for_edus(doc) cp = doc.copies self.assertTrue(is_cross_dialogue(contexts)(cp[rel]))
def test_innocent_cdu(self): "innocent: CDU entirely in dialogue" cdu = FakeCDU('c1', [self.edu1_1, self.edu1_2]) src = cdu tgt = self.edu1_3 rel = FakeRelInst('r', src, tgt) doc = FakeDocument(self.edus1, [rel], [cdu]) contexts = Context.for_edus(doc) cp = doc.copies self.assertFalse(is_cross_dialogue(contexts)(cp[rel])) self.assertFalse(is_cross_dialogue(contexts)(cp[cdu]))
def test_innocent(self): "no squawking on in-dialogue relation" src = self.edu1_1 tgt = self.edu1_2 rel = FakeRelInst('r', src, tgt) doc = FakeDocument(self.edus1, [rel], []) contexts = Context.for_edus(doc) cp = doc.copies self.assertTrue(stac.is_edu(cp[src])) self.assertTrue(stac.is_edu(cp[rel].source)) self.assertFalse(is_cross_dialogue(contexts)(cp[rel]))