コード例 #1
0
 def test__alternative_commands_can_be_handled_by_the_finalizer(self):
     s = state.post
     data = {
         'commands': {
             'my_command': {
                 'done': False,
                 'post': ['some command']
             },
             'alternative': {
                 'alias': 'my_command'
             }
         }
     }
     expected = {
         'commands': {
             'my_command': {
                 'post': ['some command']
             },
             'alternative': {
                 'alias': 'my_command'
             }
         }
     }
     parser._finish_processing(data, s)
     self.assertEqual(expected, data)
コード例 #2
0
 def test__eof_in_main_comment_state__raises_error(self):
     data = {}
     s = state.main_comment
     with self.assertRaises(Exception) as cm:
         parser._finish_processing(data, s)
     assert_exception(self, cm, SyntaxError,
                      error.PROJECTFILE_NO_COMMAND_ERROR)
コード例 #3
0
 def test__eof_in_command_comment_state__raises_error(self):
     data = {'commands': {'unfinished-command': {'done': False}}}
     s = state.command_comment
     with self.assertRaises(Exception) as cm:
         parser._finish_processing(data, s)
     assert_exception(
         self, cm, SyntaxError,
         error.PROJECTFILE_NO_COMMAND_IN_COMMAND_ERROR.format(
             'unfinished-command'))
コード例 #4
0
ファイル: test_finishing.py プロジェクト: tiborsimon/projects
 def test__eof_in_command_comment_state__raises_error(self):
     data = {
         'commands': {
             'unfinished-command': {
                 'done': False
             }
         }
     }
     s = state.command_comment
     with self.assertRaises(Exception) as cm:
         parser._finish_processing(data, s)
     assert_exception(self, cm, SyntaxError,
                      error.PROJECTFILE_NO_COMMAND_IN_COMMAND_ERROR.format('unfinished-command'))
コード例 #5
0
 def test__eof_in_post_state__data_will_be_closed(self):
     s = state.post
     data = {
         'commands': {
             'my_command': {
                 'done': False,
                 'post': ['some command']
             }
         }
     }
     expected = {'commands': {'my_command': {'post': ['some command']}}}
     parser._finish_processing(data, s)
     self.assertEqual(expected, data)
コード例 #6
0
ファイル: test_finishing.py プロジェクト: tiborsimon/projects
 def test__eof_in_post_state__data_will_be_closed(self):
     s = state.post
     data = {
         'commands': {
             'my_command': {
                 'done': False,
                 'post': ['some command']
             }
         }
     }
     expected = {
         'commands': {
             'my_command': {
                 'post': ['some command']
             }
         }
     }
     parser._finish_processing(data, s)
     self.assertEqual(expected, data)
コード例 #7
0
ファイル: test_finishing.py プロジェクト: tiborsimon/projects
 def test__eof_in_before_commands_state__raises_error(self):
     data = {}
     s = state.before_commands
     with self.assertRaises(Exception) as cm:
         parser._finish_processing(data, s)
     assert_exception(self, cm, SyntaxError, error.PROJECTFILE_NO_COMMAND_ERROR)
コード例 #8
0
 def test__eof_in_start_state__raises_error(self):
     data = {}
     s = state.start
     with self.assertRaises(Exception) as cm:
         parser._finish_processing(data, s)
     assert_exception(self, cm, SyntaxError, error.PROJECTFILE_EMPTY_ERROR)