def test_getitem_index_bound(self) -> None: """test __getitem__ function for an index in the lst""" lst = LinkedList([1, 2, 3]) actual = lst.__getitem__(1) expected = 2 assert actual == expected
def test_getitem_index_outbound(self) -> None: """test __getitem__ function for an index not in the lst""" lst = LinkedList([1, 2, 3]) try: actual = lst.__getitem__(4) except IndexError: assert True except Exception as exp: if exp != IndexError: assert False