mirror of https://github.com/01-edu/public.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
1.1 KiB
31 lines
1.1 KiB
2 years ago
|
import sys
|
||
|
|
||
|
sys.path.append('student')
|
||
|
|
||
|
from shopping import clean_list
|
||
|
|
||
|
def test_normal_input():
|
||
|
shopping_list = ['book', 'pen', 'milk', 'bread']
|
||
|
expected_output = ['1/ Book', '2/ Pen', '3/ Milk', '4/ Bread']
|
||
|
assert clean_list(shopping_list) == expected_output
|
||
|
|
||
|
def test_empty_input():
|
||
|
shopping_list = []
|
||
|
expected_output = []
|
||
|
assert clean_list(shopping_list) == expected_output
|
||
|
|
||
|
def test_multiple_spaces():
|
||
|
shopping_list = [' shirt ', ' pants ', 'milk', 'shoes']
|
||
|
expected_output = ['1/ Shirt', '2/ Pants', '3/ Milk', '4/ Shoes']
|
||
|
assert clean_list(shopping_list) == expected_output
|
||
|
|
||
|
def test_missing_milk():
|
||
|
shopping_list = ['computer', 'chair', 'desk']
|
||
|
expected_output = ['1/ Computer', '2/ Chair', '3/ Desk', '4/ Milk']
|
||
|
assert clean_list(shopping_list) == expected_output
|
||
|
|
||
|
def test_word_with_space():
|
||
|
shopping_list = ['tooth brush', 'hand sanitizer', 'milk', 'toilet paper']
|
||
|
expected_output = ['1x/ Tooth brush', '2x/ Hand sanitizer', '3x/ Milk', '4x/ Toilet Paper']
|
||
|
assert clean_list(shopping_list) == expected_output
|