示例#1
0
    def test_redo_redoes_changes(self):
        rename(self.proj, self.task_state,
               'Llama',
               'basic/foo.py',
               8)

        with self.assertRaises(ValueError):
            common.compare_projects(
                'basic',
                'main',
                'basic')

        history.undo(self.proj)

        common.compare_projects(
            'basic',
            'main',
            'basic')

        history.redo(self.proj)

        with self.assertRaises(ValueError):
            common.compare_projects(
                'basic',
                'main',
                'basic')
示例#2
0
def undo_view():
    from traad.rope.history import undo

    args = request.json
    undo(project, args['index'])

    # TODO: What if it actually fails?
    return {'result': 'success'}
示例#3
0
 def test_redo_adds_history(self):
     rename(self.proj, self.task_state,
            'Llama',
            'basic/foo.py',
            8)
     self.assertEqual(len(self.proj.proj.history.redo_list), 0)
     history.undo(self.proj)
     self.assertEqual(len(self.proj.proj.history.redo_list), 1)
示例#4
0
 def test_redo_info(self):
     rename(self.proj, self.task_state,
            'Llama',
            'basic/foo.py',
            8)
     history.undo(self.proj)
     i = history.redo_info(self.proj, 0)
     for k in ['description', 'time', 'full_change', 'changes']:
         self.assertIn(k, i)
示例#5
0
 def test_redo_history(self):
     self.assertEqual(
         len(history.redo_history(self.proj)), 0)
     rename(self.proj, self.task_state,
            'Llama',
            'basic/foo.py',
            8)
     history.undo(self.proj)
     self.assertEqual(
         len(history.redo_history(self.proj)), 1)
示例#6
0
    def test_redo_info_exceptions(self):
        with self.assertRaises(IndexError):
            history.redo_info(self.proj, 0)

        rename(self.proj, self.task_state,
               'Llama',
               'basic/foo.py',
               8)
        history.undo(self.proj)

        history.redo_info(self.proj, 0)

        with self.assertRaises(IndexError):
            history.redo_info(self.proj, 1)