Skip to content
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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

elakela
Copy link

@elakela elakela commented Nov 20, 2023

No description provided.

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]
Copy link
Collaborator

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):
Copy link
Collaborator

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:
Copy link
Collaborator

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):
    # ...

Comment on lines 4 to 7
assert is_num_present(1) == True
assert is_num_present(60) == False
assert is_num_present(90) == True
assert is_num_present(1300) == False
Copy link
Collaborator

Choose a reason for hiding this comment

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

boolean == True (o False) 👀

@TendTo
Copy link
Collaborator

TendTo commented Nov 20, 2023

Controlla anche i check falliti nella pipeline. Alcuni errori te li ho evidenziati anche io, ma altri dipendono a spazi di troppo o mancanti

Copy link
Collaborator

@Picred Picred left a 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]
Copy link
Collaborator

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

@@ -0,0 +1,7 @@
from src.verify import is_num_present

def test_present() -> None:
Copy link
Collaborator

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.

@Picred
Copy link
Collaborator

Picred commented Nov 20, 2023

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:
Copy link
Member

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

Copy link
Member

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:
Copy link
Member

Choose a reason for hiding this comment

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

stessa cosa qui

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants