Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 3c1fffea authored by HUYNH Kim-Tam's avatar HUYNH Kim-Tam
Browse files

Modify code for MR + add partial test

parent 0b64bdee
No related branches found
No related tags found
1 merge request!2Draft: Create MR to view coverage on diff
Pipeline #697784 passed
...@@ -6,8 +6,9 @@ def return_value(value): ...@@ -6,8 +6,9 @@ def return_value(value):
def raise_error(msg_kw): def raise_error(msg_kw):
raise ValueError(f"Exception {msg_kw} raised") raise ValueError(f"Exception {msg_kw} raised")
def factorielle(n):
if n == 0: def factorial(m):
if m == 0:
return 1 return 1
else: else:
return n * factorielle(n-1) return m * factorial(m-1)
import pytest import pytest
from codexample.functions import return_value, raise_error from codexample.functions import return_value, raise_error, factorial
def test_return_value(): def test_return_value():
...@@ -26,3 +26,7 @@ def test_match(): ...@@ -26,3 +26,7 @@ def test_match():
msg_kw = "123" msg_kw = "123"
with pytest.raises(ValueError, match=r".* %s .*" % msg_kw): with pytest.raises(ValueError, match=r".* %s .*" % msg_kw):
raise_error(msg_kw) raise_error(msg_kw)
def test_factorial_0():
assert factorial(0) == 1
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment