TL;DR: Python’s Simple Linked List tests for LinkedList.reversed()
does not enforce the method returns a LinkedList
and accepts any iterable.
The Python Simple Linked List exercise requires implementing a LinkedList.reversed()
method. The instructions simply say, “provide functions to reverse a linked list and […]”. My understanding is that the LinkedList.reversed()
is supposed to create a new LinkedList
object with reversed values. However, the tests, as they are currently written, only check that the returned object is iterable (and that the values are correct), allowing the method to return a list
or a generator
or anything else.
Does it make sense to explicitly test the returned object is a LinkedList
?