def test_pop(self):
     colors = Stack()
     colors.push('Magenta')
     colors.push('Alizarin')
     colors.push('Blue')
     assert colors.pop() == 'Blue'
     assert colors.pop() == 'Alizarin'
     assert colors.pop() == 'Magenta'
     assert colors.pop() is None
예제 #2
0
 def test_top(self):
     for i in range(0, 800):
         colors = Stack()
         colors.push('Blue')
         assert colors.top_node() == 'Blue'
         colors.pop()
         assert colors.top_node() is None
예제 #3
0
 def test_push(self):
     for i in range(0, 800):
         colors = Stack()
         colors.push('Pthalo Blue')
         assert colors.count == 1
         colors.push('Ultramarine Bleu')
         assert colors.count == 2
         colors.push('Magenta')
         assert colors.count == 3
         colors.push('Green')
         assert colors.count == 4
         colors.push('Red')
         assert colors.count == 5
예제 #4
0
 def test_dump(self):
     for i in range(0, 800):
         colors = Stack()
         colors.push('Magenta')
         colors.push('Alizarin')
         colors.dump('before Blue')
         colors.push('Blue')
         colors.dump('after Blue')