Skip to content

Commit bb26048

Browse files
committed
fix mypy errors
1 parent 2d0e2a4 commit bb26048

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

data_structures/linked_list/doubly_linked_list_two.py

+3
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ def set_tail(self, node: Node) -> None:
9393
if self.head is None:
9494
self.set_head(node)
9595
else:
96+
assert self.tail
9697
self.insert_after_node(self.tail, node)
9798

9899
def insert(self, value: int) -> None:
@@ -134,6 +135,8 @@ def insert_at_position(self, position: int, value: int) -> None:
134135
return
135136
current_position += 1
136137
node = node.next
138+
if not self.tail:
139+
raise IndexError(position)
137140
self.insert_after_node(self.tail, new_node)
138141

139142
def get_node(self, item: int) -> Node:

0 commit comments

Comments
 (0)