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)
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)
def test_top_empty_stack(self): s = Stack() self.assertIsNone(s.top())