def test_explain_pipeline(self): t = Transformer(False) self.assertFalse(t.explained) t2 = Transformer(True) self.assertTrue(t2.explained) p = t2.link(t) self.assertFalse(p.explained)
def test_unlink(self): t = Transformer(False) t2 = Transformer(True) t2.link(t) self.assertEqual(t.parent, t2) self.assertEqual(t2.children, (t,)) t2.unlink(t) self.assertIsNone(t.parent) self.assertEqual(t2.children, ())
def test_children(self): t = Transformer() t_c1 = Transformer() t_c2 = Transformer() t.link(t_c1) t.link(t_c2) self.assertEqual(t.children, (t_c1, t_c2)) self.assertEqual(t_c1.children, ()) self.assertEqual(t_c2.children, ())
def test_parent(self): t = Transformer(False) t2 = Transformer(True) t2.link(t) self.assertEqual(t.parent, t2) self.assertIsNone(t2.parent)