-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature - verify and test #182
base: main
Are you sure you want to change the base?
Feature - verify and test #182
Conversation
src/verify.py
Outdated
@@ -0,0 +1,17 @@ | |||
def is_num_present(num_to_check: int | float) -> bool: | |||
list_of_num = [1, 5, 13.7, 89, 90, 10, 11] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lista deve essere hardcodata? Sarebbe più funzionale passarla come parametro della funzione (a meno che la consegna non indichi diversamente)
src/verify.py
Outdated
@@ -0,0 +1,17 @@ | |||
def is_num_present(num_to_check: int | float) -> bool: | |||
list_of_num = [1, 5, 13.7, 89, 90, 10, 11] | |||
if(num_to_check in list_of_num): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quando ragioni con valori booleani non ti andare mai ad impelagare con rami if-else
.
Puoi restituire direttamente il check:
# ...
return num_to_check in list_of_num
src/verify.py
Outdated
return False | ||
|
||
def print_check(check: int | float) -> None: | ||
if is_num_present(check) == True: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
boolean == True
👀
Forse vuoi dire
is_num_present(check):
# ...
tests/test_verify.py
Outdated
assert is_num_present(1) == True | ||
assert is_num_present(60) == False | ||
assert is_num_present(90) == True | ||
assert is_num_present(1300) == False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
boolean == True
(o False
) 👀
Controlla anche i check falliti nella pipeline. Alcuni errori te li ho evidenziati anche io, ma altri dipendono a spazi di troppo o mancanti |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Potresti dare un'occhiata alla pipeline e vedere gli errori di pylint
src/verify.py
Outdated
@@ -0,0 +1,17 @@ | |||
def is_num_present(num_to_check: int | float) -> bool: | |||
list_of_num = [1, 5, 13.7, 89, 90, 10, 11] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
La list_of_num
dovrebbe contenere un unico tipo di dato
tests/test_verify.py
Outdated
@@ -0,0 +1,7 @@ | |||
from src.verify import is_num_present | |||
|
|||
def test_present() -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Potresti chiamare questa funzione test_is_num_present
per rendere il codice più chiaro. Se si leggesse prima il test e poi il codice sorgente, è più intuitivo andare a cercare la funzione present()
(che non esiste) piuttosto che la vera funzione testata.
Potresti mettere una breve descrizione della Pull Request (anche se in casi come questi è banale, è utile abituarsi a farlo, eventualmente) |
@@ -0,0 +1,14 @@ | |||
def is_num_present(num_to_check: int | float, list_of_num) -> bool: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
potresti tipizzare list_of_num
definendolo list di interi con list_of_num : List[int]
oppure con list_of_num : list[int]
se usi python 3.10
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
o magari list[float|int]
def is_num_present(num_to_check: int | float, list_of_num) -> bool: | ||
return num_to_check in list_of_num | ||
|
||
def print_check(check: int | float, list_present) -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
stessa cosa qui
No description provided.