-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
76 additions
and
127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,36 @@ | ||
|
||
def add(a, b) -> int: | ||
def add(a: int, b: int) -> int: | ||
"""Add two numbers | ||
Args: | ||
a (int): first number | ||
b (int): second number | ||
Returns: | ||
int: sum of a and b | ||
""" | ||
return a+b | ||
|
||
|
||
def test_add(): | ||
def test_add() -> None: | ||
"""Test add function | ||
""" | ||
ans = add(10, 20) | ||
expected = 30 | ||
assert ans == expected | ||
|
||
|
||
def test_add2(): | ||
def test_add2() -> None: | ||
"""Test add function | ||
""" | ||
ans = add(5, 99) | ||
expected = 104 | ||
assert ans == expected | ||
|
||
|
||
def test_add3(): | ||
def test_add3() -> None: | ||
"""Test add function | ||
""" | ||
ans = add(0, -10) | ||
excepted = -10 | ||
assert ans == excepted |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,33 @@ | ||
from main import answer, add | ||
|
||
|
||
def test_answer(): | ||
def test_answer() -> None: | ||
"""Test answer function | ||
""" | ||
expected = "Hello World!" | ||
ans = answer() | ||
assert ans == expected | ||
|
||
|
||
def test_add(): | ||
def test_add() -> None: | ||
"""Test add function | ||
""" | ||
ans = add(10, 20) | ||
expected = 30 | ||
assert ans == expected | ||
|
||
|
||
def test_add2(): | ||
def test_add2() -> None: | ||
"""Test add function | ||
""" | ||
ans = add(5, 99) | ||
expected = 104 | ||
assert ans == expected | ||
|
||
|
||
def test_add3(): | ||
"""Test add function | ||
""" | ||
ans = add(0, -10) | ||
excepted = -10 | ||
assert ans == excepted |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.