LMPTHW ex13 and ex14

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

Yes, the test_shift in the book is wrong. You’ll want to either just use what I have in the github, or just delete that test entirely. I’ve decided to make shift an alias for push, so if you did a test for push, then that tests shift.