Skip to content

Commit 53f5cba

Browse files
committed
fix: added docstring test for from_sequence
1 parent 7a9b3c7 commit 53f5cba

File tree

2 files changed

+9
-11
lines changed

2 files changed

+9
-11
lines changed

data_structures/linked_list/from_sequence.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,14 @@ def __repr__(self):
1919

2020

2121
def make_linked_list(elements_list):
22-
"""Creates a Linked List from the elements of the given sequence
23-
(list/tuple) and returns the head of the Linked List."""
22+
"""
23+
Creates a Linked List from the elements of the given sequence
24+
(list/tuple) and returns the head of the Linked List.
25+
>>> list_data = [1, 3, 5, 32, 44, 12, 43]
26+
>>> linked_list = make_linked_list(list_data)
27+
>>> print(linked_list)
28+
<1> ---> <3> ---> <5> ---> <32> ---> <44> ---> <12> ---> <43> ---> <END>
29+
"""
2430

2531
# if elements_list is empty
2632
if not elements_list:
@@ -34,11 +40,3 @@ def make_linked_list(elements_list):
3440
current.next = Node(data)
3541
current = current.next
3642
return head
37-
38-
39-
list_data = [1, 3, 5, 32, 44, 12, 43]
40-
print(f"List: {list_data}")
41-
print("Creating Linked List from List.")
42-
linked_list = make_linked_list(list_data)
43-
print("Linked List:")
44-
print(linked_list)

scripts/validate_filenames.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python3
1+
#!/usr/bin/env python
22
import os
33

44
try:

0 commit comments

Comments
 (0)