-
Notifications
You must be signed in to change notification settings - Fork 1
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
zelalemshiferaw
committed
May 11, 2024
1 parent
1af6fb1
commit e6ba4dd
Showing
3 changed files
with
18 additions
and
18 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,3 +42,5 @@ jobs: | |
coverage run -m pytest | ||
coverage report | ||
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,8 +1,18 @@ | ||
# test_hello.py | ||
from hello import app | ||
import unittest | ||
|
||
def test_hello(): | ||
response = app.test_client().get('/') | ||
def add(a, b): | ||
return a + b | ||
|
||
assert response.status_code == 200 | ||
assert response.data == b'Hello, World!' | ||
class TestAddFunction(unittest.TestCase): | ||
def test_add_positive_numbers(self): | ||
self.assertEqual(add(1, 2), 3) | ||
|
||
def test_add_negative_numbers(self): | ||
self.assertEqual(add(-1, -2), -3) | ||
|
||
def test_add_mixed_numbers(self): | ||
self.assertEqual(add(1, -2), -1) | ||
self.assertEqual(add(-1, 2), 1) | ||
|
||
if __name__ == '__main__': | ||
unittest.main() |