Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion functions/merge_sorted_lists.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
def merge_sorted_lists(l1, l2):
pass
merged = l1 + l2

return sorted(merged)
36 changes: 36 additions & 0 deletions tests/merge_sorted_lists_test.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,38 @@
import pytest
from functions.merge_sorted_lists import merge_sorted_lists


def test_for_1_and_2():
# Arrange
l1 = [1]
l2 = [2]

# Act
answer = merge_sorted_lists(l1, l2)

# Assert
assert answer == [1, 2]


def test_for_2_and_1():
# Arrange
l1 = [2]
l2 = [1]

# Act
answer = merge_sorted_lists(l1, l2)

# Assert
assert answer == [1, 2]


def test_for_1_2_3_and_4_5_6():
# Arrange
l1 = [1, 2, 3]
l2 = [4, 5, 6]

# Act
answer = merge_sorted_lists(l1, l2)

# Assert
assert answer == [1, 2, 3, 4, 5, 6]