Hello Everyone,
I noticed a bug in the test code for ex13 and ex14. The test_shift code in the book does not match the test_shift code in the Git-hub repository. This is creating some confusion on how the shift function should work, as the book asks the readers to study the test code to learn how the “Contoller” works.
test_shift code from book:
def test_shift():
colors = SingleLinkedList()
colors.shift("Cadmium Orange")
assert colors.count() == 1
colors.shift("Carbazole Violet")
assert colors.count() == 2
assert colors.pop() == "Cadmium Orange"
assert colors.count() == 1
assert colors.pop() == "Carbazole Violet"
assert colors.count() == 0
test_shift code from Github repository - (learn-more-python-the-hard-way-solutions/ex14_dllist/test_dllist.py) :
def test_shift():
colors = DoubleLinkedList()
colors.shift("Cadmium Orange")
assert colors.count() == 1
colors.shift("Carbazole Violet")
assert colors.count() == 2
assert colors.pop() == "Carbazole Violet"
assert colors.count() == 1
assert colors.pop() == "Cadmium Orange"
assert colors.count() == 0