-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathtest_lambda_keyword.py
More file actions
50 lines (31 loc) · 893 Bytes
/
test_lambda_keyword.py
File metadata and controls
50 lines (31 loc) · 893 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/env python
"""
unit tests for the lambda_keyword excercise
"""
from lambda_keyword import function_builder
#from lambda_keyword_solution import function_builder
def test_length():
"""
the function should return a list of the length input
"""
assert len(function_builder(0)) == 0
assert len(function_builder(3)) == 3
assert len(function_builder(5)) == 5
def test_result():
"""
the functions in the list should increment the input values
"""
func_list = function_builder(5)
assert func_list[0](3) == 3
assert func_list[1](3) == 4
assert func_list[2](3) == 5
assert func_list[3](3) == 6
def test_result2():
"""
the functions in the list should increment the input values
same test as above, but with different values
"""
func_list = function_builder(10)
assert func_list[0](12) == 12
assert func_list[1](10) == 11
assert func_list[9](3) == 12