def branch_test(): testdict = deepcopy(COMBINED_DICT) seash_modules.remove_commanddict(testdict, SHOW_DICT) if not seash_modules.are_cmddicts_same(testdict, GET_DICT): raise Exception("Failed to remove entire command branch GET") # Repeat the same test the other way around testdict = deepcopy(COMBINED_DICT) seash_modules.remove_commanddict(testdict, GET_DICT) if not seash_modules.are_cmddicts_same(testdict, SHOW_DICT): raise Exception("Failed to remove entire command branch SHOW")
def singlecommand_test(): # Removing a child node when there are other siblings must not have # affect the other siblings testdict = deepcopy(SHOW_DICT) seash_modules.remove_commanddict(testdict, SHOW_X_DICT) if not seash_modules.are_cmddicts_same(testdict, SHOW_DEFINED_Y_DICT): raise Exception("Failed to remove child node") # When removing a child node with a parent definition when there are other # siblings, we should remove the parent definition as well. testdict = deepcopy(SHOW_DICT) seash_modules.remove_commanddict(testdict, SHOW_DEFINED_Y_DICT) if not seash_modules.are_cmddicts_same(testdict, SHOW_X_DICT): raise Exception("Failed to remove parent node definition when removing child node")