Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge sorted list #5

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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
2 changes: 1 addition & 1 deletion functions/merge_sorted_lists.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
def merge_sorted_lists(l1, l2):
pass
return sorted(l1+l2)
35 changes: 35 additions & 0 deletions tests/merge_sorted_lists_test.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,37 @@
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]