def test_invalid_tree(self): """ Raise exception when tree is invalid """ scene = GDScene() scene.add_node("RootNode") scene.add_node("Child", parent="Missing") self.assertRaises(TreeMutationException, lambda: scene.get_node("Child"))
def test_get_node(self): """ Test for get_node() """ scene = GDScene() scene.add_node("RootNode") scene.add_node("Child", parent=".") child = scene.add_node("Child2", parent="Child") node = scene.get_node("Child/Child2") self.assertEqual(node, child)
def test_get_node_none(self): """get_node() works with no nodes""" scene = GDScene() n = scene.get_node() self.assertIsNone(n)
def test_get_missing_node(self): """ get_node on missing node should return None """ scene = GDScene() scene.add_node("RootNode") node = scene.get_node("Foo/Bar/Baz") self.assertIsNone(node)
def test_missing_root(self): """ Raise exception when GDScene is inherited but missing project_root """ scene = GDScene() scene.add_ext_node("Root", 1) self.assertRaises(RuntimeError, lambda: scene.get_node("Root"))