示例#1
0
class YAMLLoaderTestCase(TestCase):
    
    def setUp(self):
        self.loader = YAMLLoader()
    
    def tearDown(self):
        pass
    
    def test_loading_of_yaml_file(self):
        """
        Just testing loading & getting of menu items, not the content
        of the file.
        """
        menu = self.loader.load_from_file(open('src/alexandria/examples/devquiz.yaml', 'r'))
        self.assertEquals(len(menu.stack), 4)
        self.assertEquals(dump_menu(menu), [
            (msg('What is your favorite programming language?', [
                    'java', 
                    'c', 
                    'python', 
                    'ruby', 
                    'javascript', 
                    'php', 
                    'other']), False),
            (msg('What is your favorite development operating system?', [
                    'windows', 
                    'apple', 
                    '*nix', 
                    'other']), False),
            (msg('What is your favorite development environment?', [
                    'netbeans', 
                    'eclipse', 
                    'vim', 
                    'emacs', 
                    'textmate', 
                    'notepad']), False),
            (msg('Thanks! You have completed the quiz.', []), True)
        ])
    
        
示例#2
0
 def setUp(self):
     self.loader = YAMLLoader()