diff --git a/Git/exercises/ejercicio_1/src/__init__.py b/Git/exercises/ejercicio_1/src/__init__.py new file mode 100644 index 0000000..9d82e37 --- /dev/null +++ b/Git/exercises/ejercicio_1/src/__init__.py @@ -0,0 +1,5 @@ +def sum(arg): + total = 0 + for val in arg: + total += val + return total diff --git a/Git/exercises/ejercicio_1/src/__pycache__/__init__.cpython-314.pyc b/Git/exercises/ejercicio_1/src/__pycache__/__init__.cpython-314.pyc new file mode 100644 index 0000000..88a2559 Binary files /dev/null and b/Git/exercises/ejercicio_1/src/__pycache__/__init__.cpython-314.pyc differ diff --git a/Git/exercises/ejercicio_1/tests/__pycache__/sumtest.cpython-314.pyc b/Git/exercises/ejercicio_1/tests/__pycache__/sumtest.cpython-314.pyc new file mode 100644 index 0000000..07c6284 Binary files /dev/null and b/Git/exercises/ejercicio_1/tests/__pycache__/sumtest.cpython-314.pyc differ diff --git a/Git/exercises/ejercicio_1/tests/__pycache__/test.cpython-314.pyc b/Git/exercises/ejercicio_1/tests/__pycache__/test.cpython-314.pyc new file mode 100644 index 0000000..e05c34e Binary files /dev/null and b/Git/exercises/ejercicio_1/tests/__pycache__/test.cpython-314.pyc differ diff --git a/Git/exercises/ejercicio_1/tests/__pycache__/test2.cpython-314.pyc b/Git/exercises/ejercicio_1/tests/__pycache__/test2.cpython-314.pyc new file mode 100644 index 0000000..fca978f Binary files /dev/null and b/Git/exercises/ejercicio_1/tests/__pycache__/test2.cpython-314.pyc differ diff --git a/Git/exercises/ejercicio_1/tests/test.py b/Git/exercises/ejercicio_1/tests/test.py new file mode 100644 index 0000000..58d040d --- /dev/null +++ b/Git/exercises/ejercicio_1/tests/test.py @@ -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() diff --git a/Git/exercises/ejercicio_1/tests/test2.py b/Git/exercises/ejercicio_1/tests/test2.py new file mode 100644 index 0000000..88fe96d --- /dev/null +++ b/Git/exercises/ejercicio_1/tests/test2.py @@ -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()