def test_no_function_no_matching_child(self): child = {'command': 'child', 'function': dummy} node = {'command': 'test', 'children': [child]} menu_node = MenuNode(**node) with pytest.raises(InvalidArgError): menu_node.process_arg('prompt')
def test_calls_child_function(self): child = {'command': 'child', 'function': lambda: 42} node = {'command': 'test', 'children': [child]} menu_node = MenuNode(**node) assert menu_node.process_arg('child') == 42
def test_calls_function(self): node = {'command': 'test', 'function': lambda: 42} menu_node = MenuNode(**node) assert menu_node.process_arg('') == 42