Skip to content
Open
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
17 changes: 17 additions & 0 deletions src/ex3.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
def func(k:str):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Manca il return type della funzione

def func(k: str) -> str:
    # ....

match k:
case "BarackObama":
z = "44th president of the United States"
case "SandroPertini":
z = "Former President of the Italian Republic"
case "NelsonMandela":
z = "Former President of South Africa"
case "MathmaGandi":
z = "Bapu"
case "DonaldKnuthu":
z = "Creator of Latex"
case "DenniesRitchu":
z = "Creator of C"
case _:
z = "Inavlid input"
return z
12 changes: 12 additions & 0 deletions tests/testex3.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from src import ex3
import pytest

tests_a = [
{ "mock_value": "MathmaGandi", "output_value": "Bapu" },
{ "mock_value": "BarackObama", "output_value": "44th president of the United States" },
]

@pytest.mark.parametrize("test", tests_a)
def test_ex3(test: dict)->None:
mock_value = test["mock_value"]
assert ex3.func(mock_value) == test["output_value"]