def test_ancestors(self): ancs = list(ancestors(self.xc1[0]['t'])) self.assertEqual(ancs, []) ancs = list(ancestors(self.xc2[0]['t'])) self.assertEqual(len(ancs), 1) self.check(ancs[0], 't', 'alignment', 'p', ['p1']) ancs = list(ancestors(self.xc3[0]['m'])) self.assertEqual(len(ancs), 2) self.check(ancs[0], 'm', 'segmentation', 'w', ['w1', 'w2', 'w3']) self.check(ancs[1], 'w', 'segmentation', 'p', ['p1']) ancs = list(ancestors(self.xc3[0]['m']['m1'])) self.assertEqual(len(ancs), 2) self.check(ancs[0], 'm', 'segmentation', 'w', ['w1']) self.check(ancs[1], 'w', 'segmentation', 'p', ['p1'])
def test_ancestors(self): ancs = list(ancestors(xc1[0]['t'])) assert ancs == [] ancs = list(ancestors(xc2[0]['t'])) assert len(ancs) == 1 self.check(ancs[0], 't', 'alignment', 'p', ['p1']) ancs = list(ancestors(xc3[0]['m'])) assert len(ancs) == 2 self.check(ancs[0], 'm', 'segmentation', 'w', ['w1', 'w2', 'w3']) self.check(ancs[1], 'w', 'segmentation', 'p', ['p1']) ancs = list(ancestors(xc3[0]['m']['m1'])) assert len(ancs) == 2 self.check(ancs[0], 'm', 'segmentation', 'w', ['w1']) self.check(ancs[1], 'w', 'segmentation', 'p', ['p1']) ancs = list(ancestors(xc4[0]['w']['w1'])) assert len(ancs) == 1 self.check(ancs[0], 'w', 'segmentation', 'w', ['w1']) ancs = list(ancestors(xc5[0]['w'])) assert len(ancs) == 1 self.check(ancs[0], 'w', 'segmentation', 'w', ['w1', 'w2'])