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_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