File tree Expand file tree Collapse file tree 2 files changed +19
-2
lines changed
exercises/05-Defining-vs-Calling-a-function Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change 1+ # Define the function called "multi" that expects 2 parameters:
2+ def multi (num1 , num2 ):
3+ total = num1 * num2
4+ return total
5+
6+
7+ # don't edit anything below this line
8+ return_value = multi (7 ,53812212 )
9+ print (return_value )
Original file line number Diff line number Diff line change @@ -5,13 +5,21 @@ def test_declare_variable():
55 path = os .path .dirname (os .path .abspath (__file__ ))+ '/app.py'
66 with open (path , 'r' ) as content_file :
77 content = content_file .read ()
8- regex = re .compile (r"def( \s*) multi\(" )
8+ regex = re .compile (r"def\s*multi\s* \(" )
99 assert bool (regex .search (content )) == True
1010
1111@pytest .mark .it ('The function multi must exist' )
1212def test_for_callable (capsys , app ):
1313 assert callable (app .multi )
1414
15+ @pytest .mark .it ('The function multi must return a value' )
16+ def test_for_return_something (capsys , app ):
17+ assert app .multi (1 , 1 ) == True
18+
1519@pytest .mark .it ('The function multi must receive two numbers and return their multiplication' )
1620def test_for_integer (capsys , app ):
17- assert app .multi (3 ,4 ) == 12
21+ assert app .multi (3 ,4 ) == 12
22+
23+ @pytest .mark .it ('The function multi must receive two numbers and return their multiplication. Testing with different values.' )
24+ def test_for_function_return (capsys , app ):
25+ assert app .multi (10 , 6 ) == 60
You can’t perform that action at this time.
0 commit comments