checkers/check_menu.py
def check_menu(self, menu):
        """Check one menu: one object"""
        if 'children' in menu and 'command' in menu:
            self.warn("You shouldn't have a 'command' and 'children' key "
                      "in the same 'dict'.",
                      "The caption for this item is {!r}".format(menu.get('caption')))
        elif 'children' not in menu and 'command' not in menu and menu.get('caption') != '-':
            self.warn("Each 'dict' should have a 'command' or 'children' key.")

        for key, value in menu.items():
            # run value specific tests
            if key not in self.ALLOWED_KEYS.keys():
                self.fail('An unallowed key has been found',
                    'The key is {!r} and has for value {!r}'.format(key, value))
            elif name(value) != self.ALLOWED_KEYS[key]:
                self.fail('Found an unexpected type',
                          'For the key {!r}, excepted a {!r}, got a {!r}'.format(key,
                                                               self.ALLOWED_KEYS[key], name(value)))
            elif key == 'children':
                self.check_menus(menu['children'])
Check one menu: one object
Check one menu: one object
Check one menu : one object
def check_menu(self, menu):
        if 'children' in menu and 'command' in menu:
            self.warn("You shouldn't have a 'command' and 'children' key "
                      "in the same 'dict'.",
                      "The caption for this item is {!r}".format(menu.get('caption')))
        elif 'children' not in menu and 'command' not in menu and menu.get('caption') != '-':
            self.warn("Each 'dict' should have a 'command' or 'children' key.")
        for key, value in menu.items():
            if key not in self.ALLOWED_KEYS.keys():
                self.fail('An unallowed key has been found',
                    'The key is {!r} and has for value {!r}'.format(key, value))
            elif name(value) != self.ALLOWED_KEYS[key]:
                self.fail('Found an unexpected type',
                          'For the key {!r}, excepted a {!r}, got a {!r}'.format(key,
                                                               self.ALLOWED_KEYS[key], name(value)))
            elif key == 'children':
                self.check_menus(menu['children'])
def check_menu ( self , menu ) : if 'children' in menu and 'command' in menu : self . warn ( "You shouldn't have a 'command' and 'children' key " "in the same 'dict'." , "The caption for this item is {!r}" . format ( menu . get ( 'caption' ) ) ) elif 'children' not in menu and 'command' not in menu and menu . get ( 'caption' ) != '-' : self . warn ( "Each 'dict' should have a 'command' or 'children' key." ) for key , value in menu . items ( ) : if key not in self . ALLOWED_KEYS . keys ( ) : self . fail ( 'An unallowed key has been found' , 'The key is {!r} and has for value {!r}' . format ( key , value ) ) elif name ( value ) != self . ALLOWED_KEYS [ key ] : self . fail ( 'Found an unexpected type' , 'For the key {!r}, excepted a {!r}, got a {!r}' . format ( key , self . ALLOWED_KEYS [ key ] , name ( value ) ) ) elif key == 'children' : self . check_menus ( menu [ 'children' ] )
Check one menu: one object
Check one menu : one object
"""Check one menu: one object""" # run value specific tests
self
menu