def test_Parent_NoDoubleSet(self): parent = KeyedNode("parent") child = KeyedNode("child") child.set_parent(parent) imposter = KeyedNode("imposter") self.assertRaises(MultipleParentsNotSupported, lambda: child.set_parent(imposter)) self.assertEqual(child.get_parent(), parent)
def test_Parent_CanSet(self): parent = KeyedNode("parent") child = KeyedNode("child") child.set_parent(parent) self.assertEqual(child.get_parent(), parent)
def test_Parent_DefaultNone(self): child = KeyedNode("child") self.assertIsNone(child.get_parent())