Beispiel #1
0
 def test_empty(self):
     colors = Queue()
     assert colors.empty() == 'The queue is empty'
     colors.shift('Red')
     assert colors.empty() == 'The queue is not empty'
     colors.shift('Blue')
     assert colors.empty() == 'The queue is not empty'
Beispiel #2
0
 def test_tail_node(self):
     colors = Queue()
     assert colors.tail_node() is None
     colors.shift('Red')
     assert colors.tail_node() == 'Red'
     colors.shift('Blue')
     assert colors.tail_node() == 'Blue'
 def test_head_node(self):
     for i in range(0, 800):
         colors = Queue()
         assert colors.head_node() is None
         colors.shift('Red')
         assert colors.head_node() == 'Red'
         colors.shift('Blue')
         assert colors.head_node() == 'Red'
 def test_shift(self):
     for i in range(0, 800):
         colors = Queue()
         colors.shift('Red')
         assert colors.count() == 1
         colors.shift('Blue')
         assert colors.count() == 2
 def test_pop(self):
     for i in range(0, 800):
         colors = Queue()
         colors.shift('Red')
         colors.dump('before blue')
         colors.shift('Blue')
         colors.dump('after blue')
         colors.shift('Yellow')
         assert colors.pop() == 'Red'
         assert colors.pop() == 'Blue'
         assert colors.pop() == 'Yellow'
Beispiel #6
0
 def test_shift(self):
     colors = Queue()
     colors.shift('Red')
     assert colors.count() == 1
     colors.shift('Blue')
     assert colors.count() == 2