Exemplo n.º 1
0
    def test_integration(self):
        history = History([0])

        self.assertTrue(history.prev())  # 0
        self.assertTrue(history.browsing())

        self.assertTrue(history.remove(0))
        self.assertFalse(history.browsing())
        self.assertEqual(history.size(), 0)

        history.push(1)
        history.push(2)
        self.assertTrue(history.prev())  # 2
        self.assertTrue(history.prev())  # 1
        self.assertTrue(history.browsing())
        self.assertEqual(history.current_item(), 1)

        self.assertTrue(history.remove(2))
        self.assertEqual(history.current_item(), 1)

        self.assertFalse(history.next())
        self.assertFalse(history.browsing())
Exemplo n.º 2
0
    def test_push(self):
        history = History()

        history.push(0)
        self.assertEqual(history.current_item(), 0)
        self.assertFalse(history.browsing())
Exemplo n.º 3
0
    def test_push_duplicate(self):
        history = History([0, 1])

        history.push(1)
        self.assertEqual(history.current_item(), 0)