def testFindKids(self): testFile = "../testTower.txt" rawData = read_data(testFile) dictionaryOfNodes = munch_data(rawData) dictionaryOfNodes = find_kids(dictionaryOfNodes) for entry in dictionaryOfNodes: print_node(dictionaryOfNodes[entry]) pass
def testFindBottomNode(self): testFile = "../testTower.txt" rawData = read_data(testFile) dictionaryOfNodes = munch_data(rawData) dictionaryOfNodes = find_kids(dictionaryOfNodes) dictionaryOfNodes = populate_total_weight(dictionaryOfNodes) baseNodeName = find_bottom_node(dictionaryOfNodes) assert (baseNodeName == "tknk") pass
def testFindFixWeight(self): testFile = "../testTower.txt" rawData = read_data(testFile) dictionaryOfNodes = munch_data(rawData) dictionaryOfNodes = find_kids(dictionaryOfNodes) dictionaryOfNodes = populate_total_weight(dictionaryOfNodes) baseNodeName = find_bottom_node(dictionaryOfNodes) baseNode = dictionaryOfNodes[baseNodeName] adjustmentNeeded = find_fix_weight(baseNode, dictionaryOfNodes) print(adjustmentNeeded) pass
def testFindOddChild(self): testFile = "../testTower.txt" rawData = read_data(testFile) dictionaryOfNodes = munch_data(rawData) dictionaryOfNodes = find_kids(dictionaryOfNodes) dictionaryOfNodes = populate_total_weight(dictionaryOfNodes) baseNodeName = find_bottom_node(dictionaryOfNodes) baseNode = dictionaryOfNodes[baseNodeName] answerList = find_odd_child(baseNode, dictionaryOfNodes) print(answerList) pass
def testIsNodeBalanced(self): testFile = "../testTower.txt" rawData = read_data(testFile) dictionaryOfNodes = munch_data(rawData) dictionaryOfNodes = find_kids(dictionaryOfNodes) dictionaryOfNodes = populate_total_weight(dictionaryOfNodes) for entry in dictionaryOfNodes: thisNode = dictionaryOfNodes[entry] print(thisNode.name + " is Balanced?? " + str(is_node_balanced(thisNode, dictionaryOfNodes))) pass
def testFindTotaldWeight(self): print("Nodes weights as reported by find_total_wieght") testFile = "../testTower.txt" rawData = read_data(testFile) dictionaryOfNodes = munch_data(rawData) dictionaryOfNodes = find_kids(dictionaryOfNodes) for entry in dictionaryOfNodes: thisNode = dictionaryOfNodes[entry] print("Total weight of: " + thisNode.name + " is: " + str(find_total_weight(thisNode, dictionaryOfNodes))) pass