Skip to content

Commit

Permalink
Cambios
Browse files Browse the repository at this point in the history
  • Loading branch information
indadominguez committed Oct 18, 2024
1 parent 217fea1 commit 82cf1cb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/ej11_def.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ def suma_enteros(n):

suma = sum(range(1, n + 1))

return f"La suma de los enteros desde 1 hasta {n} es: {suma}"
return f"La suma de los enteros desde 1 hasta ({n}) es: ({suma})"

def main():

Expand Down
14 changes: 14 additions & 0 deletions tests/test_ej11.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import pytest
from src.ej11_def import suma_enteros

@pytest.mark.parametrize(
"input_x, expected",
[
(10, "La suma de los enteros desde 1 hasta (10) es: (55)"),
(7, "La suma de los enteros desde 1 hasta (7) es: (28)")
]
)
def test_suma_enteros(input_x, expected):
assert suma_enteros(input_x) == expected

0 comments on commit 82cf1cb

Please sign in to comment.