__contains__() isn't working for test ???
nucle0tides opened this issue · 2 comments
nucle0tides commented
see test_contains_sucess. test fails when trying to see if singleLinkListData contains "Watson"
DrNightmare commented
This test fails because the contains() method does not check the last item of a list.
The condition:
while cur.next is not None:
evaluates to false at the last before item, not the last item.
Editing this to:
while cur is not None
fixes this bug.
Also, the same method has an else:
section which is almost never executed; the method fails to return False
when an item is not present in the list; this is fixed by removing the line containing else:
and just returning False
.
nucle0tides commented
Thanks for working that one out!