def test_pop(): colors = SingleLinkedList() colors.push("Magenta") colors.push("Alizarin") assert colors.pop() == "Alizarin" assert colors.pop() == "Magenta" assert colors.pop() is None
def test_pop(): colors = SingleLinkedList() colors.push('magenta') colors.push('red') assert colors.pop() == 'red' assert colors.pop() == 'magenta' assert colors.pop() == None
def test_last(): colors = SingleLinkedList() colors.push("Cadmium Red Light") assert colors.last() == "Cadmium Red Light" colors.push("Hansa Yellow") assert colors.last() == "Hansa Yellow" colors.shift("Pthalo Green") assert colors.last() == "Hansa Yellow"
def test_last(self): colors = SingleLinkedList() colors.push('Cadmium Red Light') assert colors.last() == 'Cadmium Red Light' colors.push('Hansa Yellow') assert colors.last() == 'Hansa Yellow' colors.shift('Pthalo Green') assert colors.last() == 'Hansa Yellow'
def test_first(self): for i in range(0, 800): colors = SingleLinkedList() colors.push('Cadmium Red Light') assert colors.first() == 'Cadmium Red Light' colors.push('Hansa Yellow') assert colors.first() == 'Cadmium Red Light' colors.shift('Pthalo Green') assert colors.first() == 'Pthalo Green'
def test_push(self): colors = SingleLinkedList() 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
def test_remove(): colors = SingleLinkedList() colors.push("Cobalt") colors.push("Zinc White") colors.push("Nickle Yellow") colors.push("Perinone") assert colors.remove("Cobalt") == 0 assert colors.remove("Perinone") == 2 assert colors.remove("Nickle Yellow") == 1 assert colors.remove("Zinc White") == 0
def test_remove(self): colors = SingleLinkedList() colors.push('Cobalt') colors.push('Zinc White') colors.push('Nickle Yellow') colors.push('Perinone') assert colors.remove('Nickle Yellow') == 2 # colors.dump('before perinone') assert colors.remove('Perinone') == 2 # colors.dump('after perinone') assert colors.remove('Zinc White') == 1
def test_get(): colors = SingleLinkedList() colors.push('red') assert colors.get(0) == 'red' colors.push('yellow') assert colors.get(0) == 'red' assert colors.get(1) == 'yellow' colors.push('green') assert colors.get(0) == 'red' assert colors.get(1) == 'yellow' assert colors.get(2) == 'green' colors.pop() assert colors.get(0) == 'red' assert colors.get(1) == 'yellow' assert colors.get(2) == None colors.pop() assert colors.get(0) == 'red' assert colors.get(1) == None assert colors.get(2) == None colors.pop() assert colors.get(0) == None assert colors.get(1) == None assert colors.get(2) == None
def test_dump(): colors = SingleLinkedList() colors.push('red') colors.push('white') colors.push('blue') colors.push('yellow') assert colors.dump() == '[red, white, blue, yellow]' colors.remove('white') assert colors.dump() == '[red, blue, yellow]' colors.pop() assert colors.dump() == '[red, blue]' colors.popleft() assert colors.dump() == '[blue]'
def test_unshift(self): colors = SingleLinkedList() colors.push('Viridian') colors.push('Sap Green') colors.push('Van Dyke') assert colors.unshift() == 'Viridian' assert colors.unshift() == 'Sap Green' assert colors.unshift() == 'Van Dyke' assert colors.unshift() is None
def test_popleft(): colors = SingleLinkedList() colors.push('purple') colors.push('green') colors.push('yellow') assert colors.popleft() == 'purple' assert colors.popleft() == 'green' assert colors.popleft() == 'yellow' assert colors.popleft() == None
def test_pop(self): colors = SingleLinkedList() 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
def test_unshift(): colors = SingleLinkedList() colors.push("Viridian") colors.push("Sap Green") colors.push("Van Dyke") assert colors.unshift() == "Viridian" assert colors.unshift() == "Sap Green" assert colors.unshift() == "Van Dyke" assert colors.unshift() is None
def test_last(): colors = SingleLinkedList() colors.push('red') assert colors.last() == 'red' colors.push('yellow') assert colors.last() == 'yellow' colors.push('blue') assert colors.last() == 'blue'
def test_remove(): colors = SingleLinkedList() colors.push('red') colors.push('white') colors.push('blue') colors.push('yellow') assert colors.count() == 4 assert colors.remove('white') == True assert colors.count() == 3 assert colors.dump() == '[red, blue, yellow]' assert colors.remove('blue') == True assert colors.count() == 2 assert colors.remove('banana') == False assert colors.remove('yellow') == True assert colors.count() == 1
def test_get(): colors = SingleLinkedList() colors.push("Vermillion") assert colors.get(0) == "Vermillion" colors.push("Sap Green") assert colors.get(0) == "Vermillion" assert colors.get(1) == "Sap Green" colors.push("Cadmium Yellow Light") assert colors.get(0) == "Vermillion" assert colors.get(1) == "Sap Green" assert colors.get(2) == "Cadmium Yellow Light" assert colors.pop() == "Cadmium Yellow Light" assert colors.get(0) == "Vermillion" assert colors.get(1) == "Sap Green" assert colors.get(2) == None colors.pop() assert colors.get(0) == "Vermillion" colors.pop() assert colors.get(0) == None
def test_get(self): colors = SingleLinkedList() colors.push('Vermillion') assert colors.get(0) == 'Vermillion' colors.push('Sap Green') assert colors.get(0) == 'Vermillion' assert colors.get(1) == 'Sap Green' colors.push('Cadmium Yellow Light') assert colors.get(0) == 'Vermillion' assert colors.get(1) == 'Sap Green' assert colors.get(2) == 'Cadmium Yellow Light' assert colors.pop() == 'Cadmium Yellow Light' assert colors.get(0) == 'Vermillion' assert colors.get(1) == 'Sap Green' assert colors.get(2) is None colors.pop() assert colors.get(0) == 'Vermillion' colors.pop() assert colors.get(0) is None
def test_push(): colors = SingleLinkedList() colors.push("Pthalo Blue") assert colors.count() == 1 colors.push("Ultramarine Blue") assert colors.count() == 2
def test_push(): colors = SingleLinkedList() colors.push('blue') assert colors.count() == 1 colors.push('red') assert colors.count() == 2