Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Git/exercises/ejercicio_1/src/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
def sum(arg):
total = 0
for val in arg:
total += val
return total
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
17 changes: 17 additions & 0 deletions Git/exercises/ejercicio_1/tests/test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import unittest

from src import sum


class TestSum(unittest.TestCase):
def test_list_int(self):
"""
Test that it can sum a list of integers
"""
data = [1, 2, 3]
result = sum(data)
self.assertEqual(result, 6)


if __name__ == "__main__":
unittest.main()
17 changes: 17 additions & 0 deletions Git/exercises/ejercicio_1/tests/test2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import unittest

from src import sum


class TestSum(unittest.TestCase):
def test_list_int(self):
"""
Test that it can sum a list of integers
"""
data = [1, 32, 3]
result = sum(data)
self.assertEqual(result, 36)


if __name__ == "__main__":
unittest.main()
Loading