コード例 #1
0
    def test_redo_last(self):
        history = UndoHistory()
        self._populate_history(history)
        history.undo()

        with self.assertTraitChanges(history, 'redoable', count=1):
            with self.assertTraitDoesNotChange(history, 'undoable'):
                with self.assertTraitChanges(self._example,
                                             'anytrait',
                                             count=1):  # noqa: E501
                    history.redo()

        self.assertEqual(history.now, 3)
        self.assertTrue(history.can_undo)
        self.assertFalse(history.can_redo)