Example #1
0
 def test_clear(self):
     q = Queue()
     q.push(1)
     q.push(2)
     q.push(3)
     q.clear()
     self.assertEqual(q.size(), 0)
Example #2
0
 def test_pop(sef):
     q = Queue()
     q.push(1)
     q.push(2)
     self.assertEqual(q.pop(), 1)
     self.assertEqual(q.pop(), 2)
     self.assertEqual(q.pop(), None)
Example #3
0
 def test_type_checking(self):
     q = Queue()
     q.push('a')
     self.assertRaises(TypeError, q.push(1))
Example #4
0
 def test_push(self):
     q = Queue()
     self.assertEqual(q.size(), 0)
     q.push(1)
     q.push(2)
     self.assertEqual(q.size(), 2)
Example #5
0
 def test_size(self):
     q = Queue()
     self.assertEqual(q.size(), 0)
Example #6
0
 def test_constructor(self):
     try:
         q = Queue()
         print('TEST CONSTRUCTOR: PASS')
     except:
         print('TEST CONSTRUCTOR: FAIL')