# Path: MuseParse/classes/ObjectHierarchy/TreeClasses/BaseTree.py
# class CannotAddToTreeException(BaseException):
# class CannotFindInTreeException(BaseException):
# class Node(object):
# class EmptyNode(Node):
# class IndexedNode(Node):
# class Tree(object):
# def BackwardSearch(cls_type, node, index, depth=0, start_index=0):
# def Search(cls_type, node, index, depth=0, start_index=0):
# def FindByIndex(node, index):
# def FindPosition(node, addition, index=0):
#     def __init__(self, **kwargs):
#     def PopAllChildren(self):
#     def GetChildrenIndexes(self):
#     def SetItem(self, new_item):
#     def ReplaceChild(self, key, item):
#     def GetItem(self):
#     def GetChild(self, index):
#     def AddChild(self, item, index=-1):
#     def PopChild(self, key):
#     def AddRule(self, rule):
#     def __init__(self, duration, **kwargs):
#     def __init__(self, **kwargs):
#     def PopChild(self, key):
#     def GetChildrenIndexes(self):
#     def GetChild(self, index):
#     def AddChild(self, item, index=-1):
#     def __init__(self):
#     def AddNode(self, node, index=-1):
#     def FindNode(self, cls_type, index, id=None):
#     def FindNodeByIndex(self, index):


import unittest
from MuseParse.classes.ObjectHierarchy.TreeClasses import BaseTree
        node = self.item.FindNode(type(elem), 2)
        self.assertEqual(node, second)

    def testFindFirstEmptyNodeOnFirstChild(self):
        elem = BaseTree.Node(rules=[BaseTree.Node])
        self.item.AddNode(elem)
        second = BaseTree.Node(rules=[BaseTree.EmptyNode])
        self.item.AddNode(second)
        third = BaseTree.EmptyNode(0)
        self.item.AddNode(third)
        node = self.item.FindNode(BaseTree.EmptyNode, 1)
        self.assertEqual(node, third)

    def testFindEmptyNodeOnSecondChild(self):
        elem = BaseTree.Node(rules=[BaseTree.Node])
        self.item.AddNode(elem)
        second = BaseTree.Node()
        self.item.AddNode(second)
        third = BaseTree.Node(rules=[BaseTree.EmptyNode])
        self.item.AddNode(third)
        fourth = BaseTree.EmptyNode(0)
        self.item.AddNode(fourth)
        node = self.item.FindNode(BaseTree.EmptyNode, 1)
        self.assertEqual(node, fourth)

    def testFailure(self):
        elem = BaseTree.Node(rules=[BaseTree.Node])
        self.item.AddNode(elem)
        second = BaseTree.Node()
        self.item.AddNode(second)

# Path: MuseParse/classes/ObjectHierarchy/TreeClasses/BaseTree.py
# class CannotAddToTreeException(BaseException):
# class CannotFindInTreeException(BaseException):
# class Node(object):
# class EmptyNode(Node):
# class IndexedNode(Node):
# class Tree(object):
# def BackwardSearch(cls_type, node, index, depth=0, start_index=0):
# def Search(cls_type, node, index, depth=0, start_index=0):
# def FindByIndex(node, index):
# def FindPosition(node, addition, index=0):
#     def __init__(self, **kwargs):
#     def PopAllChildren(self):
#     def GetChildrenIndexes(self):
#     def SetItem(self, new_item):
#     def ReplaceChild(self, key, item):
#     def GetItem(self):
#     def GetChild(self, index):
#     def AddChild(self, item, index=-1):
#     def PopChild(self, key):
#     def AddRule(self, rule):
#     def __init__(self, duration, **kwargs):
#     def __init__(self, **kwargs):
#     def PopChild(self, key):
#     def GetChildrenIndexes(self):
#     def GetChild(self, index):
#     def AddChild(self, item, index=-1):
#     def __init__(self):
#     def AddNode(self, node, index=-1):
#     def FindNode(self, cls_type, index, id=None):
#     def FindNodeByIndex(self, index):


# Path: MuseParse/tests/testTree.py
import unittest
from MuseParse.classes.ObjectHierarchy.TreeClasses import BaseTree

        node = self.item.FindNode(type(elem), 2)
        self.assertEqual(node, second)

    def testFindFirstEmptyNodeOnFirstChild(self):
        elem = BaseTree.Node(rules=[BaseTree.Node])
        self.item.AddNode(elem)
        second = BaseTree.Node(rules=[BaseTree.EmptyNode])
        self.item.AddNode(second)
        third = BaseTree.EmptyNode(0)
        self.item.AddNode(third)
        node = self.item.FindNode(BaseTree.EmptyNode, 1)
        self.assertEqual(node, third)

    def testFindEmptyNodeOnSecondChild(self):
        elem = BaseTree.Node(rules=[BaseTree.Node])
        self.item.AddNode(elem)
        second = BaseTree.Node()
        self.item.AddNode(second)
        third = BaseTree.Node(rules=[BaseTree.EmptyNode])
        self.item.AddNode(third)
        fourth = BaseTree.EmptyNode(0)
        self.item.AddNode(fourth)
        node = self.item.FindNode(BaseTree.EmptyNode, 1)
        self.assertEqual(node, fourth)

    def testFailure(self):
        elem = BaseTree.Node(rules=[BaseTree.Node])
        self.item.AddNode(elem)
        second = BaseTree.Node()
        self.item.AddNode(second)

        third = BaseTree.Node(rules=[BaseTree.EmptyNode])