Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 5ce2687

Browse files
Test improved on exercise 05
1 parent 63bac30 commit 5ce2687

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

‎exercises/05-Defining-vs-Calling-a-function/solution.hide.py‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# Define the function called "multi" that expects 2 parameters:
22
def multi(num1 , num2):
33
total = num1 * num2
4-
print(total)
54
return total
65

76

‎exercises/05-Defining-vs-Calling-a-function/tests.py‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff 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')
1212
def 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')
1620
def 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

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /