def test_head(llist): assert repr(llist) == 'LinkedList()' assert llist.head is None llist.append(1) assert llist.head == 1 llist = LinkedList([-10.1, 2, 'car', 4.4, 0]) assert llist.head == -10.1 llist.pop(4) del llist[0] llist.pop(0) assert repr(llist) == 'LinkedList(car, 4.4)' assert llist.head == 'car' llist.remove('car') assert llist.head == 4.4 llist[0] = -7.8 assert llist.head == -7.8 llist.insert(0, 'check') assert llist.head == 'check' llist.appendleft(3.0) assert llist.head == 3.0 with pytest.raises(AttributeError): llist.head = None