refactor: Indent ... for visual purposes (#7744)

This commit is contained in:
Caeden Perelli-Harris
2022-10-27 18:42:30 +01:00
committed by GitHub
parent e8915097c4
commit 9bba42eca8
46 changed files with 134 additions and 134 deletions

View File

@@ -64,11 +64,11 @@ class DoublyLinkedList:
>>> linked_list = DoublyLinkedList()
>>> linked_list.insert_at_nth(-1, 666)
Traceback (most recent call last):
....
....
IndexError: list index out of range
>>> linked_list.insert_at_nth(1, 666)
Traceback (most recent call last):
....
....
IndexError: list index out of range
>>> linked_list.insert_at_nth(0, 2)
>>> linked_list.insert_at_nth(0, 1)
@@ -78,7 +78,7 @@ class DoublyLinkedList:
'1->2->3->4'
>>> linked_list.insert_at_nth(5, 5)
Traceback (most recent call last):
....
....
IndexError: list index out of range
"""
if not 0 <= index <= len(self):
@@ -114,7 +114,7 @@ class DoublyLinkedList:
>>> linked_list = DoublyLinkedList()
>>> linked_list.delete_at_nth(0)
Traceback (most recent call last):
....
....
IndexError: list index out of range
>>> for i in range(0, 5):
... linked_list.insert_at_nth(i, i + 1)
@@ -128,7 +128,7 @@ class DoublyLinkedList:
'2->4'
>>> linked_list.delete_at_nth(2)
Traceback (most recent call last):
....
....
IndexError: list index out of range
"""
if not 0 <= index <= len(self) - 1:

View File

@@ -95,11 +95,11 @@ class LinkedList:
True
>>> linked_list[-10]
Traceback (most recent call last):
...
...
ValueError: list index out of range.
>>> linked_list[len(linked_list)]
Traceback (most recent call last):
...
...
ValueError: list index out of range.
"""
if not 0 <= index < len(self):
@@ -122,11 +122,11 @@ class LinkedList:
-666
>>> linked_list[-10] = 666
Traceback (most recent call last):
...
...
ValueError: list index out of range.
>>> linked_list[len(linked_list)] = 666
Traceback (most recent call last):
...
...
ValueError: list index out of range.
"""
if not 0 <= index < len(self):
@@ -233,7 +233,7 @@ class LinkedList:
'third'
>>> linked_list.delete_head()
Traceback (most recent call last):
...
...
IndexError: List index out of range.
"""
return self.delete_nth(0)
@@ -260,7 +260,7 @@ class LinkedList:
'first'
>>> linked_list.delete_tail()
Traceback (most recent call last):
...
...
IndexError: List index out of range.
"""
return self.delete_nth(len(self) - 1)
@@ -281,11 +281,11 @@ class LinkedList:
first->third
>>> linked_list.delete_nth(5) # this raises error
Traceback (most recent call last):
...
...
IndexError: List index out of range.
>>> linked_list.delete_nth(-1) # this also raises error
Traceback (most recent call last):
...
...
IndexError: List index out of range.
"""
if not 0 <= index <= len(self) - 1: # test if index is valid