Example #1
0
    def test_push_many(self):
        s = Stack()

        for i in range(randint(2, 100)):
            s.push(i)
            self.assertEqual(s.size, i + 1)
            self.assertFalse(s.is_empty())
            self.assertEqual(s.top(), i)
Example #2
0
 def test_push_one(self):
     s = Stack()
     s.push(3)
     self.assertEqual(s.size, 1)
     self.assertFalse(s.is_empty())
     self.assertEqual(s.top(), 3)